33 #define HASHTABLE_LOADFACTOR_NUM 7
34 #define HASHTABLE_LOADFACTOR_DEN 10
42 size = 1 + size * HASHTABLE_LOADFACTOR_DEN / HASHTABLE_LOADFACTOR_NUM;
44 for (size2 = 2, bits2 = 1; size2 < size; size2 <<= 1, bits2++) ;
45 if (!(t = calloc(1,
sizeof(
hashtable_t)+ size2 *
sizeof(
unsigned))))
47 if (!(t->
etable = calloc(size2,
sizeof(
void *)))) {
54 #ifndef HASHTABLE_NBLOOM
55 if (!(t->
kbloom = calloc(size2 / 8,
sizeof(
unsigned char)))) {
59 t->
bshift =
sizeof(unsigned) * 8 - bits2;
62 #ifndef HASHTABLE_NSTATS
72 #ifndef HASHTABLE_NBLOOM
unsigned char * kbloom
Bloom filter of hash keys with k=1.
unsigned tmask
Mask to get the hashtable index.
long hashcmp_count
The count of hash compares done.
long match_count
The count of matches found.
int size
Size of allocated hashtable.
long entrycmp_count
The count of entry compares done.
unsigned bshift
Shift to get the bloomfilter index.
long find_count
The count of finds tried.
void ** etable
Table of pointers to entries.
A generic open addressing hashtable.
int count
Number of entries in hashtable.