class Ronin::ASM::ImmediateOperand
Represents an Immediate Data Operand.
Public Class Methods
new(value,width=nil)
click to toggle source
Initializes a new Immediate Operand.
@param [Integer, nil] value
The value.
@param [nil, 1, 2, 4, 8] width
The size in bytes of the value.
Calls superclass method
# File lib/ronin/asm/immediate_operand.rb, line 40 def initialize(value,width=nil) super(value.to_i,width) end
Public Instance Methods
to_i()
click to toggle source
Converts the operand to an Integer.
@return [Integer]
The value.
# File lib/ronin/asm/immediate_operand.rb, line 67 def to_i self.value end
to_s()
click to toggle source
Converts the operand to a String.
@return [String]
The value in String form.
# File lib/ronin/asm/immediate_operand.rb, line 77 def to_s self.value.to_s end
width()
click to toggle source
The width of the immediate operand.
@return [8, 4, 2, 1]
The width.
Calls superclass method
# File lib/ronin/asm/immediate_operand.rb, line 50 def width super || case value when (0x100000000..0xffffffffffffffff), (-0x7fffffffffffffff..-0x800000000) then 8 when (0x10000..0xffffffff), (-0x7fffffff..-0x80000) then 4 when (0x100..0xffff), (-0x7fff..-0x80) then 2 when (0..0xff), (-0x7f..0) then 1 end end