rubyx/lib/slot_machine/macro/div4.rb
Torsten 22d513d895 fix div4 and tests
also bug in reduce_int, compiler not carried through
2020-03-22 14:31:43 +02:00

19 lines
591 B
Ruby

module SlotMachine
class Div4 < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
integer_tmp = builder.allocate_int
integer_1 = builder.register( :integer_1 )
integer_self = builder.register( :integer_self )
builder.build do
integer_self = message[:receiver].to_reg.reduce_int(false)
load_object( 2 , integer_1)
integer_self.op :>> , integer_1
integer_tmp[Parfait::Integer.integer_index] << integer_self
message[:return_value] << integer_tmp
end
return compiler
end
end
end