Fix code generation for && and ||

- The test condition should be the same for both sides of the operators.
This commit is contained in:
Randy Heit 2016-02-07 21:56:56 -06:00
parent c63f65d441
commit 138cdccaf9

View file

@ -1681,7 +1681,7 @@ ExpEmit FxBinaryLogical::Emit(VMFunctionBuilder *build)
op2.Free(build);
ExpEmit to(build, REGT_INT);
build->Emit(OP_EQ_K, 0, op2.RegNum, zero);
build->Emit(OP_EQ_K, 1, op2.RegNum, zero);
build->Emit(OP_JMP, 2);
build->Emit(OP_LI, to.RegNum, 1);
build->Emit(OP_JMP, 1);
@ -1702,7 +1702,7 @@ ExpEmit FxBinaryLogical::Emit(VMFunctionBuilder *build)
op2.Free(build);
ExpEmit to(build, REGT_INT);
build->Emit(OP_EQ_K, 1, op2.RegNum, zero);
build->Emit(OP_EQ_K, 0, op2.RegNum, zero);
build->Emit(OP_JMP, 2);
build->Emit(OP_LI, to.RegNum, 0);
build->Emit(OP_JMP, 1);