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

Function mainposition

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

** returns the 'main' position of an element in a table (that is, the index ** of its hash value) */

Source from the content-addressed store, hash-verified

123** of its hash value)
124*/
125static Node *mainposition(const Table *t, const TValue *key) {
126 switch (ttype(key)) {
127 case LUA_TNUMINT:
128 return hashint(t, ivalue(key));
129 case LUA_TNUMFLT:
130 return hashmod(t, l_hashfloat(fltvalue(key)));
131 case LUA_TSHRSTR:
132 return hashstr(t, tsvalue(key));
133 case LUA_TLNGSTR:
134 return hashpow2(t, luaS_hashlongstr(tsvalue(key)));
135 case LUA_TBOOLEAN:
136 return hashboolean(t, bvalue(key));
137 case LUA_TLIGHTUSERDATA:
138 return hashpointer(t, pvalue(key));
139 case LUA_TLCF:
140 return hashpointer(t, fvalue(key));
141 default:
142 lua_assert(!ttisdeadkey(key));
143 return hashpointer(t, gcvalue(key));
144 }
145}
146
147
148/*

Callers 5

findindexFunction · 0.85
luaH_newkeyFunction · 0.85
getgenericFunction · 0.85
luaH_mainpositionFunction · 0.85

Calls 2

l_hashfloatFunction · 0.85
luaS_hashlongstrFunction · 0.85

Tested by

no test coverage detected