Sha256: 7f6538d6a4d844abf2d4887f29a06d2966247061ae1d5b8ae625a711f594d0cc

Contents?: true

Size: 398 Bytes

Versions: 1

Compression:

Stored size: 398 Bytes

Contents

module Lignite
  # A specialized Integer.
  # When compiling jumps, the jump instruction itself must have a constant size
  # so this class is special-cased in {OpCompiler#param_simple}.
  class JumpOffset
    # @return [Integer]
    attr_reader :value

    def size
      2
    end

    def initialize(v)
      raise "Jumping too far: #{value}" if v.abs > 32767
      @value = v
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lignite-0.6.0 lib/lignite/jump_offset.rb