MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / l_hashfloat

Function l_hashfloat

3rd/lua-5.4.3/src/ltable.c:119–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117*/
118#if !defined(l_hashfloat)
119static int l_hashfloat (lua_Number n) {
120 int i;
121 lua_Integer ni;
122 n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN);
123 if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */
124 lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL));
125 return 0;
126 }
127 else { /* normal case */
128 unsigned int u = cast_uint(i) + cast_uint(ni);
129 return cast_int(u <= cast_uint(INT_MAX) ? u : ~u);
130 }
131}
132#endif
133
134

Callers 1

mainpositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected