MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / setnodevector

Function setnodevector

Source/Misc/lua/src/lua.c:9512–9534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9510
9511
9512static void setnodevector (lua_State *L, Table *t, int size) {
9513int lsize;
9514if (size == 0) { /* no elements to hash part? */
9515t->node = cast(Node *, dummynode); /* use common `dummynode' */
9516lsize = 0;
9517}
9518else {
9519int i;
9520lsize = ceillog2(size);
9521if (lsize > MAXBITS)
9522luaG_runerror(L, "table overflow");
9523size = twoto(lsize);
9524t->node = luaM_newvector(L, size, Node);
9525for (i=0; i<size; i++) {
9526Node *n = gnode(t, i);
9527gnext(n) = NULL;
9528setnilvalue(gkey(n));
9529setnilvalue(gval(n));
9530}
9531}
9532t->lsizenode = cast_byte(lsize);
9533t->lastfree = gnode(t, size); /* all positions are free */
9534}
9535
9536
9537static void resize (lua_State *L, Table *t, int nasize, int nhsize) {

Callers 2

resizeFunction · 0.85
luaH_newFunction · 0.85

Calls 1

luaG_runerrorFunction · 0.85

Tested by

no test coverage detected