static int present (Hash *t, Object *ref) { int h = hashindex(t, ref); while (tag(ref(node(t, h))) != LUA_T_NIL) { if (lua_equalObj(ref, ref(node(t, h)))) return h; h = (h+1) % nhash(t); } return h; }
static int present (Hash *t, TObject *key) { long int h = hashindex(key); int tsize = nhash(t); int h1 = h%tsize; TObject *rf = ref(node(t, h1)); if (ttype(rf) != LUA_T_NIL && !lua_equalObj(key, rf)) { int h2 = h%(tsize-2) + 1; do { h1 = (h1+h2)%tsize; rf = ref(node(t, h1)); } while (ttype(rf) != LUA_T_NIL && !lua_equalObj(key, rf)); } return h1; }
int32 present(Hash *t, TObject *key) { int32 tsize = nhash(t); int64 h = hashindex(key); int32 h1 = int32(h % tsize); TObject *rf = ref(node(t, h1)); if (ttype(rf) != LUA_T_NIL && !luaO_equalObj(key, rf)) { int32 h2 = int32(h % (tsize - 2) + 1); do { h1 += h2; if (h1 >= tsize) h1 -= tsize; rf = ref(node(t, h1)); } while (ttype(rf) != LUA_T_NIL && !luaO_equalObj(key, rf)); } return h1; }