MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / l_hashfloat

Function l_hashfloat

lib/lua/src/ltable.c:131–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129*/
130#if !defined(l_hashfloat)
131static int l_hashfloat (lua_Number n) {
132 int i;
133 lua_Integer ni;
134 n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN);
135 if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */
136 lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL));
137 return 0;
138 }
139 else { /* normal case */
140 unsigned int u = cast_uint(i) + cast_uint(ni);
141 return cast_int(u <= cast_uint(INT_MAX) ? u : ~u);
142 }
143}
144#endif
145
146

Callers 1

mainpositionTVFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected