| 129 | */ |
| 130 | #if !defined(l_hashfloat) |
| 131 | static 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 |