In rehashtab, do counthash before adding asize

Thanks alug!
This commit is contained in:
GenericHeroGuy committed 2025-01-29 22:25:24 +01:00
1 parent b400655f3c
commit 744dc87c16
1 file changed
+6
+6
View File
@@ -359,8 +359,14 @@ static void rehashtab(lua_State *L, GCtab *t, cTValue *ek)
uint32_t total, asize, na, i;
for (i = 0; i < LJ_MAX_ABITS; i++) bins[i] = 0;
asize = countarray(t, bins);
#if 0
total = 1 + asize;
total += counthash(t, bins, &asize);
#else
/* more closely matches vanilla lua when abusing undefined behavior (frictionfix.....) */
total = counthash(t, bins, &asize);
total += 1 + asize;
#endif
asize += countint(ek, bins);
na = bestasize(bins, &asize);
total -= na;