MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / l_hashfloat

Function l_hashfloat

src/Chain/libraries/glua/ltable.cpp:105–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103*/
104#if !defined(l_hashfloat)
105static int l_hashfloat(lua_Number n) {
106 int i;
107 lua_Integer ni;
108 n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN);
109 if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */
110 lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL));
111 return 0;
112 }
113 else { /* normal case */
114 unsigned int u = lua_cast(unsigned int, i) + lua_cast(unsigned int, ni);
115 return cast_int(u <= lua_cast(unsigned int, INT_MAX) ? u : ~u);
116 }
117}
118#endif
119
120

Callers 1

mainpositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected