From 928a58ad7977c0e2e445fd9c16db5726cda789e0 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sat, 23 Oct 2021 13:01:10 +0200 Subject: Add (buggy) initial compilation of arithmetic ops --- src/bytecode/vm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/bytecode/vm.h (limited to 'src/bytecode/vm.h') diff --git a/src/bytecode/vm.h b/src/bytecode/vm.h old mode 100644 new mode 100755 index f9e64d1..3a9b5af --- a/src/bytecode/vm.h +++ b/src/bytecode/vm.h @@ -81,7 +81,7 @@ vm_interpret(VM vm, Chunk *chunk) { case OP_SUB: { Object a = array_pop(vm.stack); Object b = array_pop(vm.stack); - array_push(vm.stack, a - b); + array_push(vm.stack, b - a); } break; case OP_MUL: { Object a = array_pop(vm.stack); @@ -91,7 +91,7 @@ vm_interpret(VM vm, Chunk *chunk) { case OP_DIV: { Object a = array_pop(vm.stack); Object b = array_pop(vm.stack); - array_push(vm.stack, a / b); + array_push(vm.stack, b / a); } break; case OP_MOD: { Object a = array_pop(vm.stack); -- cgit v1.2.1