Fix order bug
authorMart Lubbers <mart@martlubbers.net>
Mon, 13 Mar 2017 08:40:06 +0000 (09:40 +0100)
committerMart Lubbers <mart@martlubbers.net>
Mon, 13 Mar 2017 08:40:06 +0000 (09:40 +0100)
client/interpret.c

index 0335f1d..ac0c0bc 100644 (file)
@@ -59,51 +59,51 @@ void run_task(struct task *t)
                        stack[sp] = stack[sp] > 0 ? 0 : 1;
                        break;
                case BCADD: trace("add");
-                       stack[sp-2] = stack[sp-1] + stack[sp-2];
+                       stack[sp-2] = stack[sp-2] + stack[sp-1];
                        sp -= 1;
                        break;
                case BCSUB: trace("sub");
-                       stack[sp-2] = stack[sp-1] - stack[sp-2];
+                       stack[sp-2] = stack[sp-2] - stack[sp-1];
                        sp -= 1;
                        break;
                case BCMUL: trace("mul");
-                       stack[sp-2] = stack[sp-1] * stack[sp-2];
+                       stack[sp-2] = stack[sp-2] * stack[sp-1];
                        sp -= 1;
                        break;
                case BCDIV: trace("div");
-                       stack[sp-2] = stack[sp-1] / stack[sp-2];
+                       stack[sp-2] = stack[sp-2] / stack[sp-1];
                        sp -= 1;
                        break;
                case BCAND: trace("and");
-                       stack[sp-2] = stack[sp-1] && stack[sp-2];
+                       stack[sp-2] = stack[sp-2] && stack[sp-1];
                        sp -= 1;
                        break;
                case BCOR: trace("or");
-                       stack[sp-2] = stack[sp-1] || stack[sp-2];
+                       stack[sp-2] = stack[sp-2] || stack[sp-1];
                        sp -= 1;
                        break;
                case BCEQ: trace("eq");
-                       stack[sp-2] = stack[sp-1] == stack[sp-2];
+                       stack[sp-2] = stack[sp-2] == stack[sp-1];
                        sp -= 1;
                        break;
                case BCNEQ: trace("neq");
-                       stack[sp-2] = stack[sp-1] != stack[sp-2];
+                       stack[sp-2] = stack[sp-2] != stack[sp-1];
                        sp -= 1;
                        break;
                case BCLES: trace("les");
-                       stack[sp-2] = stack[sp-1] < stack[sp-2];
+                       stack[sp-2] = stack[sp-2] < stack[sp-1];
                        sp -= 1;
                        break;
                case BCGRE: trace("gre");
-                       stack[sp-2] = stack[sp-1] > stack[sp-2];
+                       stack[sp-2] = stack[sp-2] > stack[sp-1];
                        sp -= 1;
                        break;
                case BCLEQ: trace("leq");
-                       stack[sp-2] = stack[sp-1] <= stack[sp-2];
+                       stack[sp-2] = stack[sp-2] <= stack[sp-1];
                        sp -= 1;
                        break;
                case BCGEQ: trace("geq");
-                       stack[sp-2] = stack[sp-1] >= stack[sp-2];
+                       stack[sp-2] = stack[sp-2] >= stack[sp-1];
                        sp -= 1;
                        break;
                case BCJMP: trace("jmp to %d", program[pc]);