Fix And and Or instructions behaviour

This commit is contained in:
Neemek 2025-01-03 22:35:40 +01:00
parent c170f0c0c6
commit 2e48fbde28
Signed by: neemek
GPG key ID: 28360A8951CD0E9B

View file

@ -367,10 +367,14 @@ func (vm *VM) Next() bool {
vm.stack.Push(!b)
case InstructionAnd:
vm.stack.Push(vm.stack.Pop().(BoolValue) && vm.stack.Pop().(BoolValue))
r := vm.stack.Pop().(BoolValue)
l := vm.stack.Pop().(BoolValue)
vm.stack.Push(l && r)
case InstructionOr:
vm.stack.Push(vm.stack.Pop().(BoolValue) || vm.stack.Pop().(BoolValue))
r := vm.stack.Pop().(BoolValue)
l := vm.stack.Pop().(BoolValue)
vm.stack.Push(r || l)
case InstructionLess:
r := vm.stack.Pop().(NumberValue)