• Home
  • Raw
  • Download

Lines Matching refs:ht

111    struct set *ht;  in _mesa_set_create()  local
113 ht = ralloc(mem_ctx, struct set); in _mesa_set_create()
114 if (ht == NULL) in _mesa_set_create()
117 ht->size_index = 0; in _mesa_set_create()
118 ht->size = hash_sizes[ht->size_index].size; in _mesa_set_create()
119 ht->rehash = hash_sizes[ht->size_index].rehash; in _mesa_set_create()
120 ht->max_entries = hash_sizes[ht->size_index].max_entries; in _mesa_set_create()
121 ht->key_hash_function = key_hash_function; in _mesa_set_create()
122 ht->key_equals_function = key_equals_function; in _mesa_set_create()
123 ht->table = rzalloc_array(ht, struct set_entry, ht->size); in _mesa_set_create()
124 ht->entries = 0; in _mesa_set_create()
125 ht->deleted_entries = 0; in _mesa_set_create()
127 if (ht->table == NULL) { in _mesa_set_create()
128 ralloc_free(ht); in _mesa_set_create()
132 return ht; in _mesa_set_create()
142 _mesa_set_destroy(struct set *ht, void (*delete_function)(struct set_entry *entry)) in _mesa_set_destroy() argument
144 if (!ht) in _mesa_set_destroy()
150 set_foreach (ht, entry) { in _mesa_set_destroy()
154 ralloc_free(ht->table); in _mesa_set_destroy()
155 ralloc_free(ht); in _mesa_set_destroy()
164 set_search(const struct set *ht, uint32_t hash, const void *key) in set_search() argument
168 hash_address = hash % ht->size; in set_search()
172 struct set_entry *entry = ht->table + hash_address; in set_search()
177 if (ht->key_equals_function(key, entry->key)) { in set_search()
182 double_hash = 1 + hash % ht->rehash; in set_search()
184 hash_address = (hash_address + double_hash) % ht->size; in set_search()
185 } while (hash_address != hash % ht->size); in set_search()
207 set_add(struct set *ht, uint32_t hash, const void *key);
210 set_rehash(struct set *ht, unsigned new_size_index) in set_rehash() argument
218 table = rzalloc_array(ht, struct set_entry, in set_rehash()
223 old_ht = *ht; in set_rehash()
225 ht->table = table; in set_rehash()
226 ht->size_index = new_size_index; in set_rehash()
227 ht->size = hash_sizes[ht->size_index].size; in set_rehash()
228 ht->rehash = hash_sizes[ht->size_index].rehash; in set_rehash()
229 ht->max_entries = hash_sizes[ht->size_index].max_entries; in set_rehash()
230 ht->entries = 0; in set_rehash()
231 ht->deleted_entries = 0; in set_rehash()
237 set_add(ht, entry->hash, entry->key); in set_rehash()
251 set_add(struct set *ht, uint32_t hash, const void *key) in set_add() argument
256 if (ht->entries >= ht->max_entries) { in set_add()
257 set_rehash(ht, ht->size_index + 1); in set_add()
258 } else if (ht->deleted_entries + ht->entries >= ht->max_entries) { in set_add()
259 set_rehash(ht, ht->size_index); in set_add()
262 hash_address = hash % ht->size; in set_add()
264 struct set_entry *entry = ht->table + hash_address; in set_add()
287 ht->key_equals_function(key, entry->key)) { in set_add()
292 double_hash = 1 + hash % ht->rehash; in set_add()
294 hash_address = (hash_address + double_hash) % ht->size; in set_add()
295 } while (hash_address != hash % ht->size); in set_add()
299 ht->deleted_entries--; in set_add()
302 ht->entries++; in set_add()
334 _mesa_set_remove(struct set *ht, struct set_entry *entry) in _mesa_set_remove() argument
340 ht->entries--; in _mesa_set_remove()
341 ht->deleted_entries++; in _mesa_set_remove()
351 _mesa_set_next_entry(const struct set *ht, struct set_entry *entry) in _mesa_set_next_entry() argument
354 entry = ht->table; in _mesa_set_next_entry()
358 for (; entry != ht->table + ht->size; entry++) { in _mesa_set_next_entry()
368 _mesa_set_random_entry(struct set *ht, in _mesa_set_random_entry() argument
372 uint32_t i = rand() % ht->size; in _mesa_set_random_entry()
374 if (ht->entries == 0) in _mesa_set_random_entry()
377 for (entry = ht->table + i; entry != ht->table + ht->size; entry++) { in _mesa_set_random_entry()
384 for (entry = ht->table; entry != ht->table + i; entry++) { in _mesa_set_random_entry()