** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i */
| 400 | ** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i |
| 401 | */ |
| 402 | static void rehash (lua_State *L, Table *t, const TValue *ek) { |
| 403 | unsigned int asize; /* optimal size for array part */ |
| 404 | unsigned int na; /* number of keys in the array part */ |
| 405 | unsigned int nums[MAXABITS + 1]; |
| 406 | int i; |
| 407 | int totaluse; |
| 408 | for (i = 0; i <= MAXABITS; i++) nums[i] = 0; /* reset counts */ |
| 409 | na = numusearray(t, nums); /* count keys in array part */ |
| 410 | totaluse = na; /* all those keys are integer keys */ |
| 411 | totaluse += numusehash(t, nums, &na); /* count keys in hash part */ |
| 412 | /* count extra key */ |
| 413 | na += countint(ek, nums); |
| 414 | totaluse++; |
| 415 | /* compute new size for array part */ |
| 416 | asize = computesizes(nums, &na); |
| 417 | /* resize the table to new computed sizes */ |
| 418 | luaH_resize(L, t, asize, totaluse - na); |
| 419 | } |
| 420 | |
| 421 | |
| 422 |
no test coverage detected