** search function for integers */
| 514 | ** search function for integers |
| 515 | */ |
| 516 | const TValue *luaH_getint (Table *t, lua_Integer key) { |
| 517 | /* (1 <= key && key <= t->sizearray) */ |
| 518 | if (l_castS2U(key) - 1 < t->sizearray) |
| 519 | return &t->array[key - 1]; |
| 520 | else { |
| 521 | Node *n = hashint(t, key); |
| 522 | for (;;) { /* check whether 'key' is somewhere in the chain */ |
| 523 | if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) |
| 524 | return gval(n); /* that's it */ |
| 525 | else { |
| 526 | int nx = gnext(n); |
| 527 | if (nx == 0) break; |
| 528 | n += nx; |
| 529 | } |
| 530 | } |
| 531 | return luaO_nilobject; |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | |
| 536 | /* |
no outgoing calls
no test coverage detected