In rehashtab, do counthash before adding asize

Thanks alug!
This commit is contained in:
GenericHeroGuy authored and Alug committed 2025-01-29 22:29:03 +01:00
1 parent c2b87b46fc
commit 3152cddb3d
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;