]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Remove dependency on <limits.h>.
authorMike Pall <mike>
Mon, 16 Dec 2024 13:27:58 +0000 (14:27 +0100)
committerMike Pall <mike>
Mon, 16 Dec 2024 13:27:58 +0000 (14:27 +0100)
Reported by yupengda002. #1318

src/lj_tab.c
src/luaconf.h

index 535a69f5d66aacbd346df5746228e8535a8db589..869c5f03c4332905f09e7dd55e55e0c5cfe1c551 100644 (file)
@@ -635,7 +635,7 @@ LJ_NOINLINE static MSize tab_len_slow(GCtab *t, size_t hi)
   while ((tv = lj_tab_getint(t, (int32_t)hi)) && !tvisnil(tv)) {
     lo = hi;
     hi += hi;
-    if (hi > (size_t)(INT_MAX-2)) {  /* Punt and do a linear search. */
+    if (hi > (size_t)(0x7fffffff - 2)) {  /* Punt and do a linear search. */
       lo = 1;
       while ((tv = lj_tab_getint(t, (int32_t)lo)) && !tvisnil(tv)) lo++;
       return (MSize)(lo - 1);
index 1cf3a03c5d903f979d182da987d80abc1c5671c2..7b15651c33a784d9a46486d82146ce8b76e29d2f 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef WINVER
 #define WINVER 0x0501
 #endif
-#include <limits.h>
 #include <stddef.h>
 
 /* Default path for loading Lua and C modules with require(). */