MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / l_hashfloat

Function l_hashfloat

extlibs/lua/src/ltable.c:114–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainpositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected