rubyx/lib/slot_machine/macro/div4.rb

19 lines
587 B
Ruby
Raw Normal View History

2019-10-03 20:07:55 +02:00
module SlotMachine
2019-09-11 19:17:43 +02:00
class Div4 < Macro
2019-09-11 18:23:56 +02:00
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 )
2019-09-11 18:23:56 +02:00
builder.build do
integer_self = message[:receiver].reduce_int(false)
load_object( 2 , integer_1)
result = integer_self.op :>> , integer_1
2020-03-15 14:15:07 +01:00
integer_tmp[Parfait::Integer.integer_index] << result
2019-09-11 18:23:56 +02:00
message[:return_value] << integer_tmp
end
return compiler
end
end
end