** Check whether key 'k1' is equal to the key in node 'n2'. ** This equality is raw, so there are no metamethods. Floats ** with integer values have been normalized, so integers cannot ** be equal to floats. It is assumed that 'eqshrstr' is simply ** pointer equality, so that short strings are handled in the ** default case. */
| 174 | ** default case. |
| 175 | */ |
| 176 | static int equalkey (const TValue *k1, const Node *n2) { |
| 177 | if (rawtt(k1) != keytt(n2)) /* not the same variants? */ |
| 178 | return 0; /* cannot be same key */ |
| 179 | switch (ttypetag(k1)) { |
| 180 | case LUA_VNIL: case LUA_VFALSE: case LUA_VTRUE: |
| 181 | return 1; |
| 182 | case LUA_VNUMINT: |
| 183 | return (ivalue(k1) == keyival(n2)); |
| 184 | case LUA_VNUMFLT: |
| 185 | return luai_numeq(fltvalue(k1), fltvalueraw(keyval(n2))); |
| 186 | case LUA_VLIGHTUSERDATA: |
| 187 | return pvalue(k1) == pvalueraw(keyval(n2)); |
| 188 | case LUA_VLCF: |
| 189 | return fvalue(k1) == fvalueraw(keyval(n2)); |
| 190 | case LUA_VLNGSTR: |
| 191 | return luaS_eqlngstr(tsvalue(k1), keystrval(n2)); |
| 192 | default: |
| 193 | return gcvalue(k1) == gcvalueraw(keyval(n2)); |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | |
| 198 | /* |
no test coverage detected