** returns the `main' position of an element in a table (that is, the index ** of its hash value) */
| 98 | ** of its hash value) |
| 99 | */ |
| 100 | static Node *mainposition (const Table *t, const TValue *key) { |
| 101 | switch (ttype(key)) { |
| 102 | case LUA_TNUMBER: |
| 103 | return hashnum(t, nvalue(key)); |
| 104 | case LUA_TSTRING: |
| 105 | return hashstr(t, rawtsvalue(key)); |
| 106 | case LUA_TBOOLEAN: |
| 107 | return hashboolean(t, bvalue(key)); |
| 108 | case LUA_TLIGHTUSERDATA: |
| 109 | return hashpointer(t, pvalue(key)); |
| 110 | default: |
| 111 | return hashpointer(t, gcvalue(key)); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | |
| 116 | /* |
no test coverage detected