Class: Crabstone::X86::Operand

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/arch/x86.rb

Instance Method Summary collapse

Instance Method Details

#fp?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/arch/x86.rb', line 70

def fp?
    self[:type] == OP_FP
end

#imm?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/arch/x86.rb', line 62

def imm?
    self[:type] == OP_IMM
end

#mem?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/arch/x86.rb', line 66

def mem?
    self[:type] == OP_MEM
end

#reg?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/arch/x86.rb', line 58

def reg?
    self[:type] == OP_REG
end

#valid?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/arch/x86.rb', line 74

def valid?
    [OP_MEM, OP_IMM, OP_FP, OP_REG].include? self[:type]
end

#valueObject

A spoonful of sugar…



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/arch/x86.rb', line 43

def value
    case self[:type]
    when OP_REG
        self[:value][:reg]
    when OP_IMM
        self[:value][:imm]
    when OP_MEM
        self[:value][:mem]
    when OP_FP
        self[:value][:fp]
    else
        nil
    end
end