** Returns the real size of the 'array' array */
| 207 | ** Returns the real size of the 'array' array |
| 208 | */ |
| 209 | LUAI_FUNC unsigned int luaH_realasize (const Table *t) { |
| 210 | if (limitequalsasize(t)) |
| 211 | return t->alimit; /* this is the size */ |
| 212 | else { |
| 213 | unsigned int size = t->alimit; |
| 214 | /* compute the smallest power of 2 not smaller than 'n' */ |
| 215 | size |= (size >> 1); |
| 216 | size |= (size >> 2); |
| 217 | size |= (size >> 4); |
| 218 | size |= (size >> 8); |
| 219 | size |= (size >> 16); |
| 220 | #if (UINT_MAX >> 30) > 3 |
| 221 | size |= (size >> 32); /* unsigned int has more than 32 bits */ |
| 222 | #endif |
| 223 | size++; |
| 224 | lua_assert(ispow2(size) && size/2 < t->alimit && t->alimit < size); |
| 225 | return size; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | |
| 230 | /* |
no outgoing calls
no test coverage detected