Lines Matching refs:htab
69 struct htab { struct
87 typedef struct htab *htab_t; argument
171 htab_size (htab_t htab) in htab_size() argument
173 return htab->size; in htab_size()
179 htab_elements (htab_t htab) in htab_elements() argument
181 return htab->n_elements - htab->n_deleted; in htab_elements()
212 htab_mod (hashval_t hash, htab_t htab) in htab_mod() argument
214 const struct prime_ent *p = &prime_tab[htab->size_prime_index]; in htab_mod()
221 htab_mod_m2 (hashval_t hash, htab_t htab) in htab_mod_m2() argument
223 const struct prime_ent *p = &prime_tab[htab->size_prime_index]; in htab_mod_m2()
228 htab_clear (htab_t htab) in htab_clear() argument
230 htab->n_elements = 0; in htab_clear()
231 htab->n_deleted = 0; in htab_clear()
232 memset (htab->entries, 0, htab->size * sizeof (hash_entry_type)); in htab_clear()
233 return htab; in htab_clear()
247 result = (htab_t) htab_alloc (sizeof (struct htab) in htab_create()
261 find_empty_slot_for_expand (htab_t htab, hashval_t hash) in find_empty_slot_for_expand() argument
263 hashval_t index = htab_mod (hash, htab); in find_empty_slot_for_expand()
264 size_t size = htab_size (htab); in find_empty_slot_for_expand()
265 hash_entry_type *slot = htab->entries + index; in find_empty_slot_for_expand()
273 hash2 = htab_mod_m2 (hash, htab); in find_empty_slot_for_expand()
280 slot = htab->entries + index; in find_empty_slot_for_expand()
295 htab_expand (htab_t htab) in htab_expand() argument
302 osize = htab->size; in htab_expand()
303 olimit = htab->entries + osize; in htab_expand()
304 elts = htab_elements (htab); in htab_expand()
312 nhtab->n_elements = htab->n_elements - htab->n_deleted; in htab_expand()
314 p = htab->entries; in htab_expand()
326 htab_free (htab); in htab_expand()
334 htab_find (htab_t htab, const hash_entry_type element) in htab_find() argument
340 size = htab_size (htab); in htab_find()
341 index = htab_mod (hash, htab); in htab_find()
343 entry = htab->entries[index]; in htab_find()
348 hash2 = htab_mod_m2 (hash, htab); in htab_find()
355 entry = htab->entries[index]; in htab_find()
377 htab_t htab = *htabp; in htab_find_slot() local
379 size = htab_size (htab); in htab_find_slot()
380 if (insert == INSERT && size * 3 <= htab->n_elements * 4) in htab_find_slot()
382 htab = *htabp = htab_expand (htab); in htab_find_slot()
383 size = htab_size (htab); in htab_find_slot()
386 index = htab_mod (hash, htab); in htab_find_slot()
390 entry = htab->entries[index]; in htab_find_slot()
394 first_deleted_slot = &htab->entries[index]; in htab_find_slot()
396 return &htab->entries[index]; in htab_find_slot()
398 hash2 = htab_mod_m2 (hash, htab); in htab_find_slot()
405 entry = htab->entries[index]; in htab_find_slot()
411 first_deleted_slot = &htab->entries[index]; in htab_find_slot()
414 return &htab->entries[index]; in htab_find_slot()
423 htab->n_deleted--; in htab_find_slot()
428 htab->n_elements++; in htab_find_slot()
429 return &htab->entries[index]; in htab_find_slot()
437 htab_clear_slot (htab_t htab, hash_entry_type *slot) in htab_clear_slot() argument
439 if (slot < htab->entries || slot >= htab->entries + htab_size (htab) in htab_clear_slot()
444 htab->n_deleted++; in htab_clear_slot()