diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-05-20 17:36:13 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-05-20 17:36:13 +0200 |
commit | 4a8b0d23a798b03c5fa2edd61313b0747b1068a0 (patch) | |
tree | e803149e54685a776f088422a649570f2cefd050 /src/lvm.js | |
parent | 4512e064eac90fa8193329fdd78a873bc0cf2b5e (diff) | |
download | fengari-4a8b0d23a798b03c5fa2edd61313b0747b1068a0.tar.gz fengari-4a8b0d23a798b03c5fa2edd61313b0747b1068a0.tar.bz2 fengari-4a8b0d23a798b03c5fa2edd61313b0747b1068a0.zip |
Fixed bad tonumber tests for bitwise opcodes
Diffstat (limited to 'src/lvm.js')
-rw-r--r-- | src/lvm.js | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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); |