** returns the 'main' position of an element in a table (that is, ** the index of its hash value). The key comes broken (tag in 'ktt' ** and value in 'vkl') so that we can call it on keys inserted into ** nodes. */
| 134 | ** nodes. |
| 135 | */ |
| 136 | static Node *mainposition (const Table *t, int ktt, const Value *kvl) { |
| 137 | switch (withvariant(ktt)) { |
| 138 | case LUA_VNUMINT: |
| 139 | return hashint(t, ivalueraw(*kvl)); |
| 140 | case LUA_VNUMFLT: |
| 141 | return hashmod(t, l_hashfloat(fltvalueraw(*kvl))); |
| 142 | case LUA_VSHRSTR: |
| 143 | return hashstr(t, tsvalueraw(*kvl)); |
| 144 | case LUA_VLNGSTR: |
| 145 | return hashpow2(t, luaS_hashlongstr(tsvalueraw(*kvl))); |
| 146 | case LUA_VFALSE: |
| 147 | return hashboolean(t, 0); |
| 148 | case LUA_VTRUE: |
| 149 | return hashboolean(t, 1); |
| 150 | case LUA_VLIGHTUSERDATA: |
| 151 | return hashpointer(t, pvalueraw(*kvl)); |
| 152 | case LUA_VLCF: |
| 153 | return hashpointer(t, fvalueraw(*kvl)); |
| 154 | default: |
| 155 | return hashpointer(t, gcvalueraw(*kvl)); |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | |
| 160 | /* |
no test coverage detected