summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-20 17:36:13 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-20 17:36:13 +0200
commit4a8b0d23a798b03c5fa2edd61313b0747b1068a0 (patch)
treee803149e54685a776f088422a649570f2cefd050 /src
parent4512e064eac90fa8193329fdd78a873bc0cf2b5e (diff)
downloadfengari-4a8b0d23a798b03c5fa2edd61313b0747b1068a0.tar.gz
fengari-4a8b0d23a798b03c5fa2edd61313b0747b1068a0.tar.bz2
fengari-4a8b0d23a798b03c5fa2edd61313b0747b1068a0.zip
Fixed bad tonumber tests for bitwise opcodes
Diffstat (limited to 'src')
-rw-r--r--src/lvm.js10
1 files 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);