MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaH_realasize

Function luaH_realasize

lib/lua/src/ltable.c:250–270  ·  view source on GitHub ↗

** Returns the real size of the 'array' array */

Source from the content-addressed store, hash-verified

248** Returns the real size of the 'array' array
249*/
250LUAI_FUNC unsigned int luaH_realasize (const Table *t) {
251 if (limitequalsasize(t))
252 return t->alimit; /* this is the size */
253 else {
254 unsigned int size = t->alimit;
255 /* compute the smallest power of 2 not smaller than 'size' */
256 size |= (size >> 1);
257 size |= (size >> 2);
258 size |= (size >> 4);
259 size |= (size >> 8);
260#if (UINT_MAX >> 14) > 3 /* unsigned int has more than 16 bits */
261 size |= (size >> 16);
262#if (UINT_MAX >> 30) > 3
263 size |= (size >> 32); /* unsigned int has more than 32 bits */
264#endif
265#endif
266 size++;
267 lua_assert(ispow2(size) && size/2 < t->alimit && t->alimit < size);
268 return size;
269 }
270}
271
272
273/*

Callers 8

luaV_executeFunction · 0.85
setlimittosizeFunction · 0.85
luaH_nextFunction · 0.85
luaH_freeFunction · 0.85
luaH_getnFunction · 0.85
traverseephemeronFunction · 0.85
traversestrongtableFunction · 0.85
clearbyvaluesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected