class Metasm::Ia32::Reg

general purpose registers, all sizes

Constants

Sym

Public Instance Methods

share?(other) click to toggle source

checks if two registers have bits in common

# File metasm/cpu/ia32/main.rb, line 132
def share?(other)
        other.val % (other.sz >> 1) == @val % (@sz >> 1) and (other.sz != @sz or @sz != 8 or other.val == @val)
end
symbolic(di=nil) click to toggle source

returns a symbolic representation of the register: eax => :eax cx => :ecx & 0xffff ah => (:eax >> 8) & 0xff

# File metasm/cpu/ia32/main.rb, line 118
def symbolic(di=nil)
        s = Sym[@val]
        if @sz == 8 and to_s[-1] == h
                Expression[[Sym[@val-4], :>>, 8], :&, 0xff]
        elsif @sz == 8
                Expression[s, :&, 0xff]
        elsif @sz == 16
                Expression[s, :&, 0xffff]
        else
                s
        end
end