From a8743d50b8a4f48e7444d4ebbf0ccbf0cddf743f Mon Sep 17 00:00:00 2001 From: GenericHeroGuy <86008856+GenericHeroGuy@users.noreply.github.com> Date: Sun, 5 Jan 2025 23:41:54 +0100 Subject: [PATCH] Fix some functions leaking doubles in INTONLY --- src/bluajit/lib_base.c | 4 ++++ src/bluajit/lib_table.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/bluajit/lib_base.c b/src/bluajit/lib_base.c index e7912c729..7ffdc3dd9 100644 --- a/src/bluajit/lib_base.c +++ b/src/bluajit/lib_base.c @@ -470,7 +470,11 @@ LJLIB_CF(collectgarbage) "\4stop\7restart\7collect\5count\1\377\4step\10setpause\12setstepmul\1\377\11isrunning"); int32_t data = lj_lib_optint(L, 2, 0); if (opt == LUA_GCCOUNT) { +#if LJ_INTONLY + setintV(L->top, G(L)->gc.total/1024); +#else setnumV(L->top, (lua_Number)G(L)->gc.total/1024.0); +#endif } else { int res = lua_gc(L, opt, data); if (opt == LUA_GCSTEP || opt == LUA_GCISRUNNING) diff --git a/src/bluajit/lib_table.c b/src/bluajit/lib_table.c index 97ba2847e..f4266b2f0 100644 --- a/src/bluajit/lib_table.c +++ b/src/bluajit/lib_table.c @@ -72,7 +72,11 @@ LJLIB_CF(table_maxn) lua_Number n = numberVnum(&node[i].key); if (n > m) m = n; } +#if LJ_INTONLY + setintV(L->top-1, lj_num2int(m)); +#else setnumV(L->top-1, m); +#endif return 1; }