From: Mart Lubbers Date: Mon, 13 Mar 2017 08:40:06 +0000 (+0100) Subject: Fix order bug X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=6f7f4cf5968d6d8a626a15eac77026236fc0667e;p=mTask.git Fix order bug --- diff --git a/client/interpret.c b/client/interpret.c index 0335f1d..ac0c0bc 100644 --- a/client/interpret.c +++ b/client/interpret.c @@ -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]);