Class: Type::I32

Inherits:
Numeric show all
Defined in:
lib/rlang/parser/ext/type.rb

Constant Summary collapse

MAX =
2**31 - 1
MIN =
-2**31

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Numeric

#type

Constructor Details

#initialize(v) ⇒ I32

Returns a new instance of I32.



26
# File 'lib/rlang/parser/ext/type.rb', line 26

def initialize(v); @v = Integer(v); end

Class Method Details

.signed?Boolean

Returns:

  • (Boolean)


28
# File 'lib/rlang/parser/ext/type.rb', line 28

def self.signed?; true; end

.sizeObject

size in bytes



30
# File 'lib/rlang/parser/ext/type.rb', line 30

def self.size; 4; end

.wasm_typeObject



32
# File 'lib/rlang/parser/ext/type.rb', line 32

def self.wasm_type; 'i32'; end

Instance Method Details

#+(v) ⇒ Object



27
# File 'lib/rlang/parser/ext/type.rb', line 27

def +(v); I32.new(v + @v); end

#sizeObject

size in bytes



29
# File 'lib/rlang/parser/ext/type.rb', line 29

def size; 4; end

#wasm_typeObject



31
# File 'lib/rlang/parser/ext/type.rb', line 31

def wasm_type; 'i32'; end