parse/htab.c
/* Finds the index that we would insert
 * the key into */
Finds the index that we would insert
the key into
Finds the index that we would insert the key into
static ssize_t htidx(Htab *ht, void *k)
{
    ssize_t i;
    ulong h;
    int di;
    di = 0;
    h = hash(ht, k);
    i = h & (ht->sz - 1);
    while (ht->hashes[i] && !ht->dead[i] && ht->hashes[i] != h) {
searchmore:
        di++;
        i = (h + di) & (ht->sz - 1);
    }
    if (!ht->hashes[i]) 
        return -1;
    if ((ht->hashes[i] == h && ht->dead[i]) || !ht->cmp(ht->keys[i], k))
        goto searchmore; 
    return i;
}
static ssize_t htidx ( Htab * ht , void * k ) { ssize_t i ; ulong h ; int di ; di = 0 ; h = hash ( ht , k ) ; i = h & ( ht -> sz - 1 ) ; while ( ht -> hashes [ i ] && ! ht -> dead [ i ] && ht -> hashes [ i ] != h ) { searchmore : di ++ ; i = ( h + di ) & ( ht -> sz - 1 ) ; } if ( ! ht -> hashes [ i ] ) return -1 ; if ( ( ht -> hashes [ i ] == h && ht -> dead [ i ] ) || ! ht -> cmp ( ht -> keys [ i ] , k ) ) goto searchmore ; return i ; }
Finds the index that we would insert
 the key into
Finds the index that we would insert the key into
/* collision */