** returns the 'main' position of an element in a table (that is, the index ** of its hash value) */
| 123 | ** of its hash value) |
| 124 | */ |
| 125 | static Node *mainposition(const Table *t, const TValue *key) { |
| 126 | switch (ttype(key)) { |
| 127 | case LUA_TNUMINT: |
| 128 | return hashint(t, ivalue(key)); |
| 129 | case LUA_TNUMFLT: |
| 130 | return hashmod(t, l_hashfloat(fltvalue(key))); |
| 131 | case LUA_TSHRSTR: |
| 132 | return hashstr(t, tsvalue(key)); |
| 133 | case LUA_TLNGSTR: |
| 134 | return hashpow2(t, luaS_hashlongstr(tsvalue(key))); |
| 135 | case LUA_TBOOLEAN: |
| 136 | return hashboolean(t, bvalue(key)); |
| 137 | case LUA_TLIGHTUSERDATA: |
| 138 | return hashpointer(t, pvalue(key)); |
| 139 | case LUA_TLCF: |
| 140 | return hashpointer(t, fvalue(key)); |
| 141 | default: |
| 142 | lua_assert(!ttisdeadkey(key)); |
| 143 | return hashpointer(t, gcvalue(key)); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | |
| 148 | /* |
no test coverage detected