From 3742b1dbf24d25e6de561e688789e1bcabd2c3f6 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Wed, 26 Apr 2017 10:39:40 +0200 Subject: Added missin |0 --- src/lobject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lobject.js b/src/lobject.js index c15101a..bd65ea8 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -463,7 +463,7 @@ const l_str2int = function(s) { if (empty || (s.length > 0 && s[0] !== 0)) return null; /* something wrong in the numeral */ else { - return neg ? -a : a; + return (neg ? -a : a)|0; } }; @@ -534,7 +534,7 @@ const intarith = function(L, op, v1, v2) { case defs.LUA_OPBXOR: return (v1 ^ v2); case defs.LUA_OPSHL: return (v1 << v2); case defs.LUA_OPSHR: return (v1 >> v2); - case defs.LUA_OPUNM: return (0 - v1); + case defs.LUA_OPUNM: return (0 - v1)|0; case defs.LUA_OPBNOT: return (~0 ^ v1); } }; -- cgit v1.2.3-70-g09d2