Class: Ronin::Code::ASM::ImmediateOperand

Inherits:
Struct
  • Object
show all
Defined in:
lib/ronin/code/asm/immediate_operand.rb

Overview

Represents an Immediate Data Operand.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, width = nil) ⇒ ImmediateOperand

Initializes a new Immediate Operand.

Parameters:

  • value (Integer, nil)

    The value.

  • width (nil, 1, 2, 4, 8) (defaults to: nil)

    The size in bytes of the value.



40
41
42
# File 'lib/ronin/code/asm/immediate_operand.rb', line 40

def initialize(value,width=nil)
  super(value.to_i,width)
end

Instance Attribute Details

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



29
30
31
# File 'lib/ronin/code/asm/immediate_operand.rb', line 29

def value
  @value
end

#width8, ...

The width of the immediate operand.

Returns:

  • (8, 4, 2, 1)

    The width.



29
30
31
# File 'lib/ronin/code/asm/immediate_operand.rb', line 29

def width
  @width
end

Instance Method Details

#to_iInteger

Converts the operand to an Integer.

Returns:

  • (Integer)

    The value.



67
68
69
# File 'lib/ronin/code/asm/immediate_operand.rb', line 67

def to_i
  self.value
end

#to_sString

Converts the operand to a String.

Returns:

  • (String)

    The value in String form.



77
78
79
# File 'lib/ronin/code/asm/immediate_operand.rb', line 77

def to_s
  self.value.to_s
end