cr8r_hashtbl_t Struct Reference

A hash table. More...

#include <hash.h>

Data Fields

void * table_a
 Buffer for the main internal table.
 
void * table_b
 Buffer for the second internal table if present.
 
uint64_t * flags_a
 Metadata about which entries are present/deleted/absent in the main table. More...
 
uint64_t * flags_b
 Metadata about which entries are present/deleted/absent in the second table.
 
uint64_t cap
 Total number of elements that can be stored before expanding the table. More...
 
uint64_t len_a
 Length of buffer for main internal table (in elements not bytes).
 
uint64_t len_b
 Length of buffer for second internal table (in elements not bytes).
 
uint64_t i
 Current index for incremental rehashing.
 
uint64_t r
 Amount of entries that are rehashed at once. More...
 
uint64_t full
 Total number of elements currently in the table.
 

Detailed Description

A hash table.

Fields of this struct should not be edited directly, only through the functions in this file.

Definition at line 24 of file hash.h.

Field Documentation

◆ flags_a

uint64_t* cr8r_hashtbl_t::flags_a

Metadata about which entries are present/deleted/absent in the main table.

Two bits per entry: present bit and deleted bit.

Definition at line 31 of file hash.h.

◆ cap

uint64_t cr8r_hashtbl_t::cap

Total number of elements that can be stored before expanding the table.

Recomputed only when the table actually expands. In particular, inserting multiple elements with different load factors in the function table will not cause a re-hash (cr8r_hashtbl_ft::load_factor, cr8r_hash_insert).

Definition at line 38 of file hash.h.

◆ r

uint64_t cr8r_hashtbl_t::r

Amount of entries that are rehashed at once.

Like cr8r_hashtbl_t::cap, this is only updated when the table expands (or incrementally moving entries from the old table to the new table finishes).

Definition at line 48 of file hash.h.


The documentation for this struct was generated from the following file: