** Returns the real size of the 'array' array */
| 239 | ** Returns the real size of the 'array' array |
| 240 | */ |
| 241 | LUAI_FUNC unsigned int luaH_realasize (const Table *t) { |
| 242 | if (limitequalsasize(t)) |
| 243 | return t->alimit; /* this is the size */ |
| 244 | else { |
| 245 | unsigned int size = t->alimit; |
| 246 | /* compute the smallest power of 2 not smaller than 'n' */ |
| 247 | size |= (size >> 1); |
| 248 | size |= (size >> 2); |
| 249 | size |= (size >> 4); |
| 250 | size |= (size >> 8); |
| 251 | size |= (size >> 16); |
| 252 | #if (UINT_MAX >> 30) > 3 |
| 253 | size |= (size >> 32); /* unsigned int has more than 32 bits */ |
| 254 | #endif |
| 255 | size++; |
| 256 | lua_assert(ispow2(size) && size/2 < t->alimit && t->alimit < size); |
| 257 | return size; |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | |
| 262 | /* |
no outgoing calls
no test coverage detected