Fast 8-way hash table with rehashing possibility.
More...
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Fast 8-way hash table with rehashing possibility.
- Author
- Matej Vido, xvido.nosp@m.m00@.nosp@m.stud..nosp@m.fit..nosp@m.vutbr.nosp@m..cz
- Date
- 2014
Definition in file fast_hash_filter.h.
◆ FHF_COL_FULL
#define FHF_COL_FULL ((uint8_t) 0xFF) |
◆ FHF_TABLE_COLS
◆ UINT64_MAX
◆ fhf_table_t
Hash table structure.
Free flag: 0 - free 1 - full
MSB LSB
Bits | X | X | X | X | X | X | X | X | Index of item in row 7 6 5 4 3 2 1 0
Definition at line 133 of file fast_hash_filter.h.
◆ fhf_found
Constants used for get and update data functions.
Enumerator |
---|
FHF_FOUND | |
FHF_NOT_FOUND | |
Definition at line 93 of file fast_hash_filter.h.
◆ fhf_insert
Constants used for insert functions.
Enumerator |
---|
FHF_INSERT_OK | |
FHF_INSERT_FAILED | |
FHF_INSERT_FULL | |
Definition at line 75 of file fast_hash_filter.h.
◆ fhf_iter
Constants used for iterator functions.
Enumerator |
---|
FHF_ITER_RET_OK | |
FHF_ITER_RET_END | |
FHF_ITER_START | |
FHF_ITER_END | |
Definition at line 109 of file fast_hash_filter.h.
◆ fhf_remove
Constants used for removing functions.
Enumerator |
---|
FHF_REMOVED | |
FHF_NOT_REMOVED | |
Definition at line 101 of file fast_hash_filter.h.
◆ fhf_resize
Constants used for resizing function.
Enumerator |
---|
FHF_RESIZE_OK | |
FHF_RESIZE_FAILED_ALLOC | |
FHF_RESIZE_FAILED_INSERT | |
Definition at line 84 of file fast_hash_filter.h.
◆ fhf_clear()
Function for clearing table.
Function sets free flags of all items in the table to zero. Items with zero free flags are considered free. Data and keys remain in table while they are replaced by new items.
- Parameters
-
table | Pointer to the table structure. |
◆ fhf_destroy()
Function for destroying table and freeing memory.
Function frees memory of the whole table structure.
- Parameters
-
table | Pointer to the table structure. |
◆ fhf_destroy_iter()
Function for destroying iterator and freeing memory.
If function is used in the middle of the table, function also unlocks row, which is locked.
- Parameters
-
iter | Pointer to the existing iterator. |
◆ fhf_init()
fhf_table_t* fhf_init |
( |
uint64_t |
table_rows, |
|
|
uint32_t |
key_size, |
|
|
uint32_t |
data_size |
|
) |
| |
Function for initializing table.
Parameters need to meet following requirements: table_rows - non-zero, power of two key_size - non-zero data_size - non-zero
- Parameters
-
table_rows | Number of rows in the table. |
key_size | Size of key in bytes. |
data_size | Size of data in bytes. |
- Returns
- Pointer to the hash table structure, NULL if the memory could not be allocated or parameters do not meet requirements.
◆ fhf_init_iter()
Function for initializing iterator for the table.
- Parameters
-
table | Pointer to the table structure. |
- Returns
- Pointer to the iterator structure. NULL if could not allocate memory.
◆ fhf_reinit_iter()
Function for reinitializing iterator for table.
- Parameters
-
iter | Pointer to the existing iterator. |
◆ fhf_lt_free_flag
uint8_t fhf_lt_free_flag[] |
◆ fhf_lt_pow_of_two
uint8_t fhf_lt_pow_of_two[] |