node/lib/metasm/metasm/cpu/cy16/decode.rb
# updates an instruction's argument replacing an expression with another (eg label renamed)
updates an instruction's argument replacing an expression with another
updates an instruction ' s argument replacing an expression with another
def replace_instr_arg_immediate(i, old, new)
		i.args.map! { |a|
			case a
			when Expression; a == old ? new : Expression[a.bind(old => new).reduce]
			when Memref
				a.offset = (a.offset == old ? new : Expression[a.offset.bind(old => new).reduce]) if a.offset
				a
			else a
			end
		}
	end
def replace_instr_arg_immediate ( i , old , new ) i . args . map! { | a | case a when Expression ; a == old ? new : Expression [ a . bind ( old => new ) . reduce ] when Memref a . offset = ( a . offset == old ? new : Expression [ a . offset . bind ( old => new ) . reduce ] ) if a . offset a else a end } end
updates an instruction's argument replacing an expression with another (eg label renamed)
updates an instruction ' s argument replacing an expression with another ( eg label renamed )
i
old
new