MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / setnodevector

Function setnodevector

src/Chain/libraries/glua/ltable.cpp:444–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442
443
444static void setnodevector(lua_State *L, Table *t, unsigned int size) {
445 int lsize;
446 if (size == 0) { /* no elements to hash part? */
447 t->node = lua_cast(Node *, dummynode); /* use common 'dummynode' */
448 lsize = 0;
449 }
450 else {
451 int i;
452 lsize = luaO_ceillog2(size);
453 if (lsize > MAXHBITS)
454 luaG_runerror(L, "table overflow");
455 size = twoto(lsize);
456 t->node = luaM_newvector(L, size, Node);
457 for (i = 0; i < (int)size; i++) {
458 Node *n = gnode(t, i);
459 gnext(n) = 0;
460 setnilvalue(wgkey(n));
461 setnilvalue(gval(n));
462 }
463 }
464 t->lsizenode = cast_byte(lsize);
465 t->lastfree = gnode(t, size); /* all positions are free */
466}
467
468
469void 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