node/lib/metasm/metasm/decode.rb
def decode_imm(type, endianness)
		raise "invalid imm type #{type.inspect}" if not isz = Expression::INT_SIZE[type]
		if rel = @reloc[@ptr]
			if Expression::INT_SIZE[rel.type] == isz and rel.endianness == endianness
				@ptr += rel.length
				return rel.target
			end
			puts "W: Immediate type/endianness mismatch, ignoring relocation #{rel.target.inspect} (wanted #{type.inspect})" if $DEBUG
		end
		Expression.decode_imm(read(isz/8), type, endianness)
	end
# decodes an immediate value from self.ptr, advances ptr
# returns an Expression on relocation, or an ::Integer
# if ptr has a relocation but the type/endianness does not match, the reloc is ignored and a warning is issued
# TODO arg type => sign+len
decodes an immediate value from self.ptr, advances ptr
returns an Expression on relocation, or an ::Integer
if ptr has a relocation but the type/endianness does not match, the reloc is ignored and a warning is issued
TODO arg type => sign+len
decodes an immediate value from self . ptr advances ptr returns an Expression on relocation or an :: Integer if ptr has a relocation but the type / endianness does not match the reloc is ignored and a warning is issued TODO arg type = > sign + len
def decode_imm(type, endianness)
		raise "invalid imm type #{type.inspect}" if not isz = Expression::INT_SIZE[type]
		if rel = @reloc[@ptr]
			if Expression::INT_SIZE[rel.type] == isz and rel.endianness == endianness
				@ptr += rel.length
				return rel.target
			end
			puts "W: Immediate type/endianness mismatch, ignoring relocation #{rel.target.inspect} (wanted #{type.inspect})" if $DEBUG
		end
		Expression.decode_imm(read(isz/8), type, endianness)
	end
def decode_imm ( type , endianness ) raise "invalid imm type #{type.inspect}" if not isz = Expression :: INT_SIZE [ type ] if rel = @reloc [ @ptr ] if Expression :: INT_SIZE [ rel . type ] == isz and rel . endianness == endianness @ptr += rel . length return rel . target end puts "W: Immediate type/endianness mismatch, ignoring relocation #{rel.target.inspect} (wanted #{type.inspect})" if $DEBUG end Expression . decode_imm ( read ( isz / 8 ) , type , endianness ) end
decodes an immediate value from self.ptr, advances ptr
returns an Expression on relocation, or an ::Integer
if ptr has a relocation but the type/endianness does not match, the reloc is ignored and a warning is issued
TODO arg type => sign+len
decodes an immediate value from self . ptr advances ptr returns an Expression on relocation or an :: Integer if ptr has a relocation but the type / endianness does not match the reloc is ignored and a warning is issued TODO arg type = > sign + len
type
endianness