void bighash_insert(bighash_table_t *table, bighash_entry_t *e, uint32_t hash) { bighash_entry_t **bucket = bighash_bucket(table, hash); e->next = *bucket; e->hash = hash; *bucket = e; table->entry_count++; }
bighash_entry_t * bighash_first(bighash_table_t *table, uint32_t hash) { bighash_entry_t *e = *bighash_bucket(table, hash); while (e != NULL) { if (e->hash == hash) { return e; } e = e->next; } return NULL; }
void bighash_remove(bighash_table_t *table, bighash_entry_t *e) { bighash_entry_t **prev_ptr = bighash_bucket(table, e->hash); bighash_entry_t *cur = *prev_ptr; while (cur != NULL) { if (cur == e) { *prev_ptr = cur->next; table->entry_count--; return; } prev_ptr = &cur->next; cur = *prev_ptr; } }
void bighash_insert(bighash_table_t *table, bighash_entry_t *e, uint32_t hash) { bighash_entry_t **bucket = bighash_bucket(table, hash); e->next = *bucket; e->hash = hash; *bucket = e; table->entry_count++; if (table->flags & BIGHASH_TABLE_F_AUTOGROW) { if (table->entry_count >= table->bucket_count*BIGHASH_CONFIG_LOAD_FACTOR) { bighash_grow(table); } } }