** search function for integers */
| 629 | ** search function for integers |
| 630 | */ |
| 631 | const TValue *luaH_getint(Table *t, lua_Integer key) { |
| 632 | /* (1 <= key && key <= t->sizearray) */ |
| 633 | if (l_castS2U(key) - 1 < t->sizearray) |
| 634 | return &t->array[key - 1]; |
| 635 | else { |
| 636 | Node *n = hashint(t, key); |
| 637 | for (;;) { /* check whether 'key' is somewhere in the chain */ |
| 638 | if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) |
| 639 | return gval(n); /* that's it */ |
| 640 | else { |
| 641 | int nx = gnext(n); |
| 642 | if (nx == 0) break; |
| 643 | n += nx; |
| 644 | } |
| 645 | } |
| 646 | return luaO_nilobject; |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | |
| 651 | /* |
no outgoing calls
no test coverage detected