MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / mainposition

Function mainposition

deps/lua/src/ltable.c:100–113  ·  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

98** of its hash value)
99*/
100static Node *mainposition (const Table *t, const TValue *key) {
101 switch (ttype(key)) {
102 case LUA_TNUMBER:
103 return hashnum(t, nvalue(key));
104 case LUA_TSTRING:
105 return hashstr(t, rawtsvalue(key));
106 case LUA_TBOOLEAN:
107 return hashboolean(t, bvalue(key));
108 case LUA_TLIGHTUSERDATA:
109 return hashpointer(t, pvalue(key));
110 default:
111 return hashpointer(t, gcvalue(key));
112 }
113}
114
115
116/*

Callers 4

findindexFunction · 0.85
newkeyFunction · 0.85
luaH_getFunction · 0.85
luaH_mainpositionFunction · 0.85

Calls 1

hashnumFunction · 0.85

Tested by

no test coverage detected