MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / hashint

Function hashint

third-party/lua-5.5.0/src/ltable.c:145–151  ·  view source on GitHub ↗

** Hash for integers. To allow a good hash, use the remainder operator ** ('%'). If integer fits as a non-negative int, compute an int ** remainder, which is faster. Otherwise, use an unsigned-integer ** remainder, which uses all bits and ensures a non-negative result. */

Source from the content-addressed store, hash-verified

143** remainder, which uses all bits and ensures a non-negative result.
144*/
145static Node *hashint (const Table *t, lua_Integer i) {
146 lua_Unsigned ui = l_castS2U(i);
147 if (ui <= cast_uint(INT_MAX))
148 return gnode(t, cast_int(ui) % cast_int((sizenode(t)-1) | 1));
149 else
150 return hashmod(t, ui);
151}
152
153
154/*

Callers 4

mainpositionTVFunction · 0.70
getintfromhashFunction · 0.70
mainpositionFunction · 0.50
luaH_getintFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected