Lines Matching defs:hash
274 // Elements of the hash table (key/value pairs)
276 int hash; // store hash key to speed hash table expansion
280 #define ZMSLOTINIT(hash, key, val) {hash, key, val}
282 // zmap: Mapping data type for arrays; a hash table. Values in hash are either
287 // of the original hash value.
290 int *hash; // (mask + 1) elements
292 int count; // number of occupied slots in hash
586 static struct zmap_slot *find_mapslot(struct zmap *m, struct zstring *key, int *hash, int *probe)
589 unsigned perturb = *hash = zstring_hash(key);
590 *probe = *hash & m->mask;
592 while ((n = m->hash[*probe])) {
595 if (*hash == x->hash && zstring_match(key, x->key)) {
618 int hash, probe;
619 struct zmap_slot *x = find_mapslot(m, key, &hash, &probe);
627 m->hash = xzalloc(INIT_SIZE * sizeof(*m->hash));
649 xfree(m->hash);
663 int *h = xzalloc(2 * size * sizeof(*m->hash));
664 // Step through the old hash table, set up location in new table.
666 int n = m->hash[i];
668 int hash = MAPSLOT[n-1].hash;
669 unsigned perturb = hash;
670 int p = hash & mask;
678 xfree(m->hash);
679 m->hash = h;
685 int hash, probe;
686 struct zmap_slot *x = find_mapslot(m, key, &hash, &probe);
692 x = find_mapslot(m, key, &hash, &probe);
695 struct zmap_slot zs = ZMSLOTINIT(hash, key, (struct zvalue)ZVINIT(0, 0.0, 0));
699 m->hash[probe] = n + 1;
705 int hash, probe;
706 struct zmap_slot *x = find_mapslot(m, key, &hash, &probe);
708 zstring_release(&MAPSLOT[m->hash[probe] - 1].key);
709 m->hash[probe] = -1;