fix type-to-string conv. + fix binary type check + add modulo + rework import (now include)
Some checks failed
/ test (push) Failing after 41s
Some checks failed
/ test (push) Failing after 41s
This commit is contained in:
parent
91baf28fdf
commit
575fd8e37a
7 changed files with 131 additions and 91 deletions
|
|
@ -41,6 +41,8 @@ const (
|
|||
InstructionMulInt
|
||||
// InstructionDivInt pop two ints and divide the second by the first
|
||||
InstructionDivInt
|
||||
// InstructionModInt pop two ints and compute the modulo of the first by the second
|
||||
InstructionModInt
|
||||
// InstructionNegateInt negate the int; if it was positive, make it negative, and vice versa.
|
||||
InstructionNegateInt
|
||||
|
||||
|
|
@ -810,6 +812,12 @@ func (vm *VM) Next() bool {
|
|||
|
||||
vm.Stack.Push(&IntegerValue{new(big.Int).Div(l, r)})
|
||||
|
||||
case InstructionModInt:
|
||||
r := vm.Stack.Pop().(*IntegerValue).Number
|
||||
l := vm.Stack.Pop().(*IntegerValue).Number
|
||||
|
||||
vm.Stack.Push(&IntegerValue{new(big.Int).Mod(l, r)})
|
||||
|
||||
case InstructionNegateInt:
|
||||
v := vm.Stack.Pop().(*IntegerValue).Number
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue