diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-22 15:56:07 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-22 15:56:07 +1000 |
commit | d6e4dc3e7684f32c614fa26b6d66eab57e64eb86 (patch) | |
tree | e8487243e1615f497042f2dcbc9606ec446bbdf4 | |
parent | fc06de96b0458e9b2fd8442523891fccbd7bf3d1 (diff) | |
download | fengari-d6e4dc3e7684f32c614fa26b6d66eab57e64eb86.tar.gz fengari-d6e4dc3e7684f32c614fa26b6d66eab57e64eb86.tar.bz2 fengari-d6e4dc3e7684f32c614fa26b6d66eab57e64eb86.zip |
src/lmathlib.js: math.ult needs to compare as if integers are unsigned
-rw-r--r-- | src/lmathlib.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lmathlib.js b/src/lmathlib.js index 0c3b715..b10f7bf 100644 --- a/src/lmathlib.js +++ b/src/lmathlib.js @@ -129,7 +129,9 @@ const math_sqrt = function(L) { const math_ult = function(L) { let a = lauxlib.luaL_checkinteger(L, 1); let b = lauxlib.luaL_checkinteger(L, 2); - lua.lua_pushboolean(L, Math.abs(a) < Math.abs(b)); + if (a < 0) a += 4294967296; + if (b < 0) b += 4294967296; + lua.lua_pushboolean(L, a < b); return 1; }; |