** Hash for integers. To allow a good hash, use the remainder operator ** ('%'). If integer fits as a non-negative int, compute an int ** remainder, which is faster. Otherwise, use an unsigned-integer ** remainder, which uses all bits and ensures a non-negative result. */
| 143 | ** remainder, which uses all bits and ensures a non-negative result. |
| 144 | */ |
| 145 | static Node *hashint (const Table *t, lua_Integer i) { |
| 146 | lua_Unsigned ui = l_castS2U(i); |
| 147 | if (ui <= cast_uint(INT_MAX)) |
| 148 | return gnode(t, cast_int(ui) % cast_int((sizenode(t)-1) | 1)); |
| 149 | else |
| 150 | return hashmod(t, ui); |
| 151 | } |
| 152 | |
| 153 | |
| 154 | /* |
no outgoing calls
no test coverage detected