From 4a8b0d23a798b03c5fa2edd61313b0747b1068a0 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sat, 20 May 2017 17:36:13 +0200 Subject: Fixed bad tonumber tests for bitwise opcodes --- src/lvm.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lvm.js b/src/lvm.js index 6857b1d..35a4a51 100644 --- a/src/lvm.js +++ b/src/lvm.js @@ -312,7 +312,7 @@ const luaV_execute = function(L) { let numberop1 = tointeger(op1); let numberop2 = tointeger(op2); - if (numberop1 !== false && numberop2) { + if (numberop1 !== false && numberop2 !== false) { L.stack[ra] = new lobject.TValue(CT.LUA_TNUMINT, (numberop1 & numberop2)); } else { ltm.luaT_trybinTM(L, op1, op2, ra, ltm.TMS.TM_BAND); @@ -325,7 +325,7 @@ const luaV_execute = function(L) { let numberop1 = tointeger(op1); let numberop2 = tointeger(op2); - if (numberop1 !== false && numberop2) { + if (numberop1 !== false && numberop2 !== false) { L.stack[ra] = new lobject.TValue(CT.LUA_TNUMINT, (numberop1 | numberop2)); } else { ltm.luaT_trybinTM(L, op1, op2, ra, ltm.TMS.TM_BOR); @@ -338,7 +338,7 @@ const luaV_execute = function(L) { let numberop1 = tointeger(op1); let numberop2 = tointeger(op2); - if (numberop1 !== false && numberop2) { + if (numberop1 !== false && numberop2 !== false) { L.stack[ra] = new lobject.TValue(CT.LUA_TNUMINT, (numberop1 ^ numberop2)); } else { ltm.luaT_trybinTM(L, op1, op2, ra, ltm.TMS.TM_BXOR); @@ -351,7 +351,7 @@ const luaV_execute = function(L) { let numberop1 = tointeger(op1); let numberop2 = tointeger(op2); - if (numberop1 !== false && numberop2) { + if (numberop1 !== false && numberop2 !== false) { L.stack[ra] = new lobject.TValue(CT.LUA_TNUMINT, (numberop1 << numberop2)); // TODO: luaV_shiftl ? } else { ltm.luaT_trybinTM(L, op1, op2, ra, ltm.TMS.TM_SHL); @@ -364,7 +364,7 @@ const luaV_execute = function(L) { let numberop1 = tointeger(op1); let numberop2 = tointeger(op2); - if (numberop1 !== false && numberop2) { + if (numberop1 !== false && numberop2 !== false) { L.stack[ra] = new lobject.TValue(CT.LUA_TNUMINT, (numberop1 >> numberop2)); } else { ltm.luaT_trybinTM(L, op1, op2, ra, ltm.TMS.TM_SHR); -- cgit v1.2.3-70-g09d2