MCPcopy Create free account
hub / github.com/Tencent/xLua / setnodevector

Function setnodevector

WebGLPlugins/ltable.c:308–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306
307
308static void setnodevector (lua_State *L, Table *t, unsigned int size) {
309 if (size == 0) { /* no elements to hash part? */
310 t->node = cast(Node *, dummynode); /* use common 'dummynode' */
311 t->lsizenode = 0;
312 t->lastfree = NULL; /* signal that it is using dummy node */
313 }
314 else {
315 int i;
316 int lsize = luaO_ceillog2(size);
317 if (lsize > MAXHBITS)
318 luaG_runerror(L, "table overflow");
319 size = twoto(lsize);
320 t->node = luaM_newvector(L, size, Node);
321 for (i = 0; i < (int)size; i++) {
322 Node *n = gnode(t, i);
323 gnext(n) = 0;
324 setnilvalue(wgkey(n));
325 setnilvalue(gval(n));
326 }
327 t->lsizenode = cast_byte(lsize);
328 t->lastfree = gnode(t, size); /* all positions are free */
329 }
330}
331
332
333void luaH_resize (lua_State *L, Table *t, unsigned int nasize,

Callers 2

luaH_resizeFunction · 0.85
luaH_newFunction · 0.85

Calls 2

luaO_ceillog2Function · 0.85
luaG_runerrorFunction · 0.85

Tested by

no test coverage detected