adds multiplication

without overflow testing, like the others
This commit is contained in:
Torsten Ruger
2018-04-01 21:18:08 +03:00
parent 1d57c59dab
commit 3a9539a071
5 changed files with 57 additions and 42 deletions

View File

@ -184,7 +184,7 @@ module Risc
end
obj = space.get_class_by_name(:Integer)
[ :putint, :mod4, :div10, :+ , :-].each do |f| #mod4 is just a forward declaration
[ :putint, :mod4, :div10, :+ , :- , :*].each do |f| #mod4 is just a forward declaration
obj.instance_type.add_method Builtin::Integer.send(f , nil)
end
end

View File

@ -23,6 +23,9 @@ module Risc
compiler.add_mom( Mom::ReturnSequence.new)
return compiler.method
end
def *( context )
operator_method( "mult" , :*)
end
def +( context )
operator_method( "plus" , :+)
end