From b2fb7a9302693fe5e164469eedb802b54e460347 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 23 May 2017 11:44:14 +1000 Subject: src/lmathlib.js: Optimise math.ult See https://jsperf.com/unsigned-comparison --- src/lmathlib.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/lmathlib.js') diff --git a/src/lmathlib.js b/src/lmathlib.js index 8000b4d..4a62d52 100644 --- a/src/lmathlib.js +++ b/src/lmathlib.js @@ -132,9 +132,7 @@ const math_sqrt = function(L) { const math_ult = function(L) { let a = lauxlib.luaL_checkinteger(L, 1); let b = lauxlib.luaL_checkinteger(L, 2); - if (a < 0) a += 4294967296; - if (b < 0) b += 4294967296; - lua.lua_pushboolean(L, a < b); + lua.lua_pushboolean(L, (a >= 0)?(b<0 || a