MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / rehash

Function rehash

third-party/lua-5.2.4/src/ltable.c:343–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341
342
343static void rehash (lua_State *L, Table *t, const TValue *ek) {
344 int nasize, na;
345 int nums[MAXBITS+1]; /* nums[i] = number of keys with 2^(i-1) < k <= 2^i */
346 int i;
347 int totaluse;
348 for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */
349 nasize = numusearray(t, nums); /* count keys in array part */
350 totaluse = nasize; /* all those keys are integer keys */
351 totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */
352 /* count extra key */
353 nasize += countint(ek, nums);
354 totaluse++;
355 /* compute new size for array part */
356 na = computesizes(nums, &nasize);
357 /* resize the table to new computed sizes */
358 luaH_resize(L, t, nasize, totaluse - na);
359}
360
361
362

Callers 1

luaH_newkeyFunction · 0.70

Calls 5

numusearrayFunction · 0.70
numusehashFunction · 0.70
countintFunction · 0.70
computesizesFunction · 0.70
luaH_resizeFunction · 0.70

Tested by

no test coverage detected