Class: RMasm::Word

Inherits:
Primitive show all
Defined in:
lib/rmasm/primitive.rb

Overview

Represents a word (16 bits)

Constant Summary collapse

MIN =
-32768
MAX =
65535

Instance Attribute Summary

Attributes inherited from Primitive

#value

Class Method Summary collapse

Methods inherited from Primitive

valid?

Methods inherited from DataType

read, valid?, write

Class Method Details

.from_str(str) ⇒ Object



107
108
109
# File 'lib/rmasm/primitive.rb', line 107

def self.from_str(str)
  str.unpack("v*")
end

.rangeObject



101
102
103
# File 'lib/rmasm/primitive.rb', line 101

def self.range
  return MIN..MAX
end

.sizeofObject



104
105
106
# File 'lib/rmasm/primitive.rb', line 104

def self.sizeof
  2
end

.to_sObject



110
111
112
# File 'lib/rmasm/primitive.rb', line 110

def self.to_s
  "word"
end