fix type-to-string conv. + fix binary type check + add modulo + rework import (now include)
Some checks failed
/ test (push) Failing after 41s

This commit is contained in:
Neemek 2026-07-13 23:34:19 +02:00
parent 91baf28fdf
commit 575fd8e37a
Signed by: neemek
GPG key ID: 84FFE4D7D40AB25E
7 changed files with 131 additions and 91 deletions

View file

@ -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