Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
union | HASH_DATA |
union of the possibles data values of a node More... | |
struct | HASH_NODE |
structure of a hash table node More... | |
struct | HASH_TABLE |
structure of a hash table More... | |
Macros | |
#define | HASH_CLASSIC 128 |
Murmur hash using hash key string, hash key numeric value, index table with lists of elements. More... | |
#define | HASH_DOUBLE 2 |
value of double type inside the hash node More... | |
#define | HASH_INT 1 |
compatibility with existing rot func More... | |
#define | HASH_PTR 8 |
value of pointer type inside the hash node More... | |
#define | HASH_STRING 4 |
value of char * type inside the hash node More... | |
#define | HASH_TRIE 256 |
TRIE tree using hash key string. More... | |
#define | HASH_UNKNOWN 16 |
value of unknow type inside the hash node More... | |
#define | hash_val(node, type) ( (node && node -> ptr) ? ( (type *)( ( (HASH_NODE *)node -> ptr )-> data . ptr) ) : NULL ) |
Cast a HASH_NODE element. More... | |
#define | HASH_VAL(node, type) ( (node && node -> data . ptr) ? ( (type *)node -> data . ptr ) : NULL ) |
Cast a HASH_NODE element. More... | |
#define | ht_foreach(__ITEM_, __HASH_) |
ForEach macro helper (classic / old) More... | |
#define | HT_FOREACH(__ITEM_, __HASH_, ...) |
ForEach macro helper. More... | |
#define | HT_FOREACH_R(__ITEM_, __HASH_, __ITERATOR, ...) |
ForEach macro helper. More... | |
#define | ht_foreach_r(__ITEM_, __HASH_, __ITERATOR_) |
ForEach macro helper, reentrant (classic / old) More... | |
#define | MurmurHash(__key, __len, __seed, __out) MurmurHash3_x64_128( __key, __len, __seed, __out ) |
Murmur hash macro helper 64 bits. More... | |
Typedefs | |
typedef size_t | HASH_VALUE |
type of a HASH_VALUE More... | |
Functions | |
int | destroy_ht (HASH_TABLE **table) |
empty a table and destroy it More... | |
int | empty_ht (HASH_TABLE *table) |
empty a table More... | |
LIST * | ht_get_completion_list (HASH_TABLE *table, const char *keybud, size_t max_results) |
get next matching keys in table tree More... | |
int | ht_get_double (HASH_TABLE *table, const char *key, double *val) |
get double at 'key' from 'table' More... | |
int | ht_get_int (HASH_TABLE *table, const char *key, int *val) |
get node at 'key' from 'table' More... | |
HASH_NODE * | ht_get_node (HASH_TABLE *table, const char *key) |
get node at 'key' from 'table' More... | |
HASH_NODE * | ht_get_node_ex (HASH_TABLE *table, HASH_VALUE hash_value) |
return the associated key's node inside the hash_table (HASH_CLASSIC only) More... | |
int | ht_get_optimal_size (HASH_TABLE *table) |
get optimal array size based on nb=(number_of_key*1.3) && if( !isprime(nb) )nb=nextprime(nb) (HASH_CLASSIC mode only) More... | |
int | ht_get_ptr (HASH_TABLE *table, const char *key, void **val) |
get pointer at 'key' from 'table' More... | |
int | ht_get_ptr_ex (HASH_TABLE *table, HASH_VALUE hash_value, void **val) |
Retrieve a pointer value in the hash table, at the given key. More... | |
int | ht_get_string (HASH_TABLE *table, const char *key, char **val) |
get string at 'key' from 'table' More... | |
int | ht_get_table_collision_percentage (HASH_TABLE *table) |
get table collision percentage (HASH_CLASSIC mode only) More... | |
char * | ht_node_type (HASH_NODE *node) |
get the type of a node , text version More... | |
int | ht_optimize (HASH_TABLE **table) |
try an automatic optimization of the table More... | |
void | ht_print (HASH_TABLE *table) |
print contents of table More... | |
int | ht_put_double (HASH_TABLE *table, const char *key, double value) |
put a double value with given key in the targeted hash table More... | |
int | ht_put_int (HASH_TABLE *table, const char *key, int value) |
put an integral value with given key in the targeted hash table More... | |
int | ht_put_ptr (HASH_TABLE *table, const char *key, void *ptr, void(*destructor)(void *ptr)) |
put a pointer to the string value with given key in the targeted hash table More... | |
int | ht_put_ptr_ex (HASH_TABLE *table, HASH_VALUE hash_value, void *val, void(*destructor)(void *ptr)) |
put a pointer value with given key in the targeted hash table (HASH_CLASSIC only) More... | |
int | ht_put_string (HASH_TABLE *table, const char *key, char *string) |
put a string value (copy/dup) with given key in the targeted hash table More... | |
int | ht_put_string_ptr (HASH_TABLE *table, const char *key, char *string) |
put a string value (pointer) with given key in the targeted hash table More... | |
int | ht_remove (HASH_TABLE *table, const char *key) |
remove and delete node at key in table More... | |
int | ht_remove_ex (HASH_TABLE *table, HASH_VALUE hash_value) |
Remove a key from a hash table (HASH_CLASSIC only) More... | |
int | ht_resize (HASH_TABLE **table, size_t size) |
rehash table according to size (HASH_CLASSIC mode only) More... | |
LIST * | ht_search (HASH_TABLE *table, int(*node_is_matching)(HASH_NODE *node)) |
seach table for matching nodes More... | |
int | is_prime (int nb) |
test if number is a prime number or not More... | |
void | MurmurHash3_x64_128 (const void *key, const size_t len, const uint64_t seed, void *out) |
MurmurHash3 was written by Austin Appleby, and is placed in the public domain. More... | |
void | MurmurHash3_x86_128 (const void *key, int len, uint32_t seed, void *out) |
MurmurHash3 was written by Austin Appleby, and is placed in the public domain. More... | |
void | MurmurHash3_x86_32 (const void *key, int len, uint32_t seed, void *out) |
MurmurHash3 was written by Austin Appleby, and is placed in the public domain. More... | |
HASH_TABLE * | new_ht (size_t size) |
Create a hash table with the given size. More... | |
HASH_TABLE * | new_ht_trie (size_t alphabet_size, size_t alphabet_offset) |
create a TRIE hash table with the alphabet_size, each key value beeing decreased by alphabet_offset More... | |
int | next_prime (int nb) |
compute next prime number after nb More... | |
union HASH_DATA |
struct HASH_NODE |
Data Fields | |
size_t | alphabet_length |
HASH_TRIE mode: size of alphabet and so size of children allocated array. More... | |
struct HASH_NODE ** | children |
HASH_TRIE mode: pointers to children. More... | |
union HASH_DATA | data |
data inside the node More... | |
void(* | destroy_func )(void *ptr) |
destroy_func More... | |
HASH_VALUE | hash_value |
numeric key of the node if any, else < 0 More... | |
int | is_leaf |
HASH_TRIE mode: does it have a value. More... | |
char * | key |
string key of the node if any, else NULL More... | |
char | key_id |
key id of the node if any More... | |
int | need_rehash |
flag to mark a node for rehash More... | |
int | type |
type of the node More... | |
size_t HASH_NODE::alphabet_length |
struct HASH_NODE** HASH_NODE::children |
HASH_TRIE mode: pointers to children.
Definition at line 101 of file n_hash.h.
Referenced by _ht_check_trie_divergence().
HASH_VALUE HASH_NODE::hash_value |
int HASH_NODE::is_leaf |
char* HASH_NODE::key |
struct HASH_TABLE |
structure of a hash table
Data Fields | |
size_t | alphabet_length |
HASH_TRIE mode: size of the alphabet. More... | |
size_t | alphabet_offset |
HASH_TRIE mode: offset to deduce to individual key digits. More... | |
int(* | destroy_ht )(struct HASH_TABLE **table) |
destroy a hash table More... | |
int(* | empty_ht )(struct HASH_TABLE *table) |
empty a hash table. More... | |
LIST ** | hash_table |
HASH_CLASSIC mode: preallocated hash table. More... | |
int(* | ht_get_double )(struct HASH_TABLE *table, const char *key, double *val) |
get a double from a key's node More... | |
int(* | ht_get_int )(struct HASH_TABLE *table, const char *key, int *val) |
get an int from a key's node More... | |
HASH_NODE *(* | ht_get_node )(struct HASH_TABLE *table, const char *key) |
get HASH_NODE at 'key' from table More... | |
int(* | ht_get_ptr )(struct HASH_TABLE *table, const char *key, void **val) |
get a pointer from a key's node More... | |
int(* | ht_get_string )(struct HASH_TABLE *table, const char *key, char **val) |
get a char *string from a key's node More... | |
void(* | ht_print )(struct HASH_TABLE *table) |
print table More... | |
int(* | ht_put_double )(struct HASH_TABLE *table, const char *key, double val) |
put a double More... | |
int(* | ht_put_int )(struct HASH_TABLE *table, const char *key, int val) |
put an integer More... | |
int(* | ht_put_ptr )(struct HASH_TABLE *table, const char *key, void *ptr, void(*destructor)(void *ptr)) |
put a a pointer More... | |
int(* | ht_put_string )(struct HASH_TABLE *table, const char *key, char *val) |
put an char *string More... | |
int(* | ht_put_string_ptr )(struct HASH_TABLE *table, const char *key, char *val) |
put an char *string pointer More... | |
int(* | ht_remove )(struct HASH_TABLE *table, const char *key) |
remove given's key node from the table More... | |
LIST *(* | ht_search )(struct HASH_TABLE *table, int(*node_is_matching)(HASH_NODE *node)) |
search elements given an expression More... | |
unsigned int | mode |
hashing mode, murmurhash and classic HASH_MURMUR, or HASH_TRIE More... | |
size_t | nb_keys |
total number of used keys in the table More... | |
HASH_NODE * | root |
HASH_TRIE mode: Start of tree. More... | |
size_t | seed |
table's seed More... | |
size_t | size |
size of the hash table More... | |
size_t HASH_TABLE::alphabet_length |
size_t HASH_TABLE::alphabet_offset |
int(* HASH_TABLE::destroy_ht) (struct HASH_TABLE **table) |
int(* HASH_TABLE::empty_ht) (struct HASH_TABLE *table) |
LIST** HASH_TABLE::hash_table |
int(* HASH_TABLE::ht_get_double) (struct HASH_TABLE *table, const char *key, double *val) |
get a double from a key's node
Definition at line 141 of file n_hash.h.
Referenced by ht_get_double().
int(* HASH_TABLE::ht_get_int) (struct HASH_TABLE *table, const char *key, int *val) |
HASH_NODE *(* HASH_TABLE::ht_get_node) (struct HASH_TABLE *table, const char *key) |
get HASH_NODE at 'key' from table
Definition at line 127 of file n_hash.h.
Referenced by ht_get_node().
int(* HASH_TABLE::ht_get_ptr) (struct HASH_TABLE *table, const char *key, void **val) |
int(* HASH_TABLE::ht_get_string) (struct HASH_TABLE *table, const char *key, char **val) |
get a char *string from a key's node
Definition at line 145 of file n_hash.h.
Referenced by ht_get_string().
void(* HASH_TABLE::ht_print) (struct HASH_TABLE *table) |
int(* HASH_TABLE::ht_put_double) (struct HASH_TABLE *table, const char *key, double val) |
int(* HASH_TABLE::ht_put_int) (struct HASH_TABLE *table, const char *key, int val) |
int(* HASH_TABLE::ht_put_ptr) (struct HASH_TABLE *table, const char *key, void *ptr, void(*destructor)(void *ptr)) |
int(* HASH_TABLE::ht_put_string) (struct HASH_TABLE *table, const char *key, char *val) |
int(* HASH_TABLE::ht_put_string_ptr) (struct HASH_TABLE *table, const char *key, char *val) |
put an char *string pointer
Definition at line 137 of file n_hash.h.
Referenced by ht_put_string_ptr().
int(* HASH_TABLE::ht_remove) (struct HASH_TABLE *table, const char *key) |
remove given's key node from the table
Definition at line 147 of file n_hash.h.
Referenced by ht_remove().
LIST *(* HASH_TABLE::ht_search) (struct HASH_TABLE *table, int(*node_is_matching)(HASH_NODE *node)) |
unsigned int HASH_TABLE::mode |
size_t HASH_TABLE::nb_keys |
size_t HASH_TABLE::size |
size of the hash table
Definition at line 111 of file n_hash.h.
Referenced by _ht_get_node(), _ht_remove(), ht_get_node_ex(), ht_put_ptr_ex(), and ht_remove_ex().
#define HASH_CLASSIC 128 |
#define HASH_DOUBLE 2 |
#define HASH_INT 1 |
#define HASH_PTR 8 |
#define HASH_STRING 4 |
#define HASH_UNKNOWN 16 |
#define hash_val | ( | node, | |
type | |||
) | ( (node && node -> ptr) ? ( (type *)( ( (HASH_NODE *)node -> ptr )-> data . ptr) ) : NULL ) |
#define HASH_VAL | ( | node, | |
type | |||
) | ( (node && node -> data . ptr) ? ( (type *)node -> data . ptr ) : NULL ) |
#define ht_foreach | ( | __ITEM_, | |
__HASH_ | |||
) |
ForEach macro helper (classic / old)
#define HT_FOREACH | ( | __ITEM_, | |
__HASH_, | |||
... | |||
) |
ForEach macro helper.
#define HT_FOREACH_R | ( | __ITEM_, | |
__HASH_, | |||
__ITERATOR, | |||
... | |||
) |
ForEach macro helper.
#define ht_foreach_r | ( | __ITEM_, | |
__HASH_, | |||
__ITERATOR_ | |||
) |
ForEach macro helper, reentrant (classic / old)
#define MurmurHash | ( | __key, | |
__len, | |||
__seed, | |||
__out | |||
) | MurmurHash3_x64_128( __key, __len, __seed, __out ) |
typedef size_t HASH_VALUE |
int destroy_ht | ( | HASH_TABLE ** | table | ) |
empty a table and destroy it
table | targeted hash table |
Definition at line 2448 of file n_hash.c.
References __n_assert.
Referenced by close_nodup_log(), destroy_config_file_section(), netw_destroy_pool(), new_ht(), and new_ht_trie().
int empty_ht | ( | HASH_TABLE * | table | ) |
empty a table
table | targeted hash table |
Definition at line 2435 of file n_hash.c.
References __n_assert, and empty_ht().
Referenced by empty_ht(), empty_nodup_table(), new_ht(), and new_ht_trie().
LIST * ht_get_completion_list | ( | HASH_TABLE * | table, |
const char * | keybud, | ||
size_t | max_results | ||
) |
get next matching keys in table tree
table | targeted hash table |
keybud | starting characters of the keys we want |
max_results | maximum number of matching keys in list |
Definition at line 2630 of file n_hash.c.
References __n_assert, _ht_depth_first_search(), _ht_get_node_trie(), HASH_CLASSIC, HASH_TRIE, ht_search(), list_destroy(), list_push(), LOG_ERR, n_log, and new_generic_list().
int ht_get_double | ( | HASH_TABLE * | table, |
const char * | key, | ||
double * | val | ||
) |
get double at 'key' from 'table'
table | targeted table |
key | key to retrieve |
val | pointer to double storage |
Definition at line 2250 of file n_hash.c.
References __n_assert, and ht_get_double.
Referenced by new_ht(), and new_ht_trie().
int ht_get_int | ( | HASH_TABLE * | table, |
const char * | key, | ||
int * | val | ||
) |
get node at 'key' from 'table'
table | targeted table |
key | key to retrieve |
val | pointer to int storage |
Definition at line 2266 of file n_hash.c.
References __n_assert, and ht_get_int.
Referenced by new_ht(), and new_ht_trie().
HASH_NODE * ht_get_node | ( | HASH_TABLE * | table, |
const char * | key | ||
) |
get node at 'key' from 'table'
table | targeted table |
key | key to retrieve |
Definition at line 2234 of file n_hash.c.
References __n_assert, and ht_get_node.
Referenced by _n_nodup_log(), _n_nodup_log_indexed(), check_n_log_dup(), check_n_log_dup_indexed(), and new_ht().
HASH_NODE * ht_get_node_ex | ( | HASH_TABLE * | table, |
HASH_VALUE | hash_value | ||
) |
return the associated key's node inside the hash_table (HASH_CLASSIC only)
table | Targeted hash table |
hash_value | Associated hash_value |
Definition at line 2462 of file n_hash.c.
References __n_assert, HASH_CLASSIC, list_foreach, and size.
Referenced by ht_get_ptr_ex().
int ht_get_optimal_size | ( | HASH_TABLE * | table | ) |
get optimal array size based on nb=(number_of_key*1.3) && if( !isprime(nb) )nb=nextprime(nb) (HASH_CLASSIC mode only)
table | targeted table |
Definition at line 2765 of file n_hash.c.
References __n_assert, is_prime(), and next_prime().
Referenced by ht_optimize().
int ht_get_ptr | ( | HASH_TABLE * | table, |
const char * | key, | ||
void ** | val | ||
) |
get pointer at 'key' from 'table'
table | targeted table |
key | key to retrieve |
val | pointer to pointer storage |
Definition at line 2282 of file n_hash.c.
References __n_assert, and ht_get_ptr().
Referenced by get_config_section_value(), get_nb_config_file_sections_entries(), ht_get_ptr(), load_config_file(), netw_pool_add(), new_ht(), and new_ht_trie().
int ht_get_ptr_ex | ( | HASH_TABLE * | table, |
HASH_VALUE | hash_value, | ||
void ** | val | ||
) |
Retrieve a pointer value in the hash table, at the given key.
Leave val untouched if key is not found. (HASH_CLASSIC only)
table | Targeted hash table |
hash_value | key pre computed numeric hash value |
val | A pointer to an empty pointer store |
Definition at line 2496 of file n_hash.c.
References __n_assert, HASH_CLASSIC, HASH_PTR, ht_get_node_ex(), ht_node_type(), LOG_ERR, and n_log.
int ht_get_string | ( | HASH_TABLE * | table, |
const char * | key, | ||
char ** | val | ||
) |
get string at 'key' from 'table'
table | targeted table |
key | key to retrieve |
val | pointer to string storage |
Definition at line 2298 of file n_hash.c.
References __n_assert, and ht_get_string.
Referenced by new_ht(), and new_ht_trie().
int ht_get_table_collision_percentage | ( | HASH_TABLE * | table | ) |
get table collision percentage (HASH_CLASSIC mode only)
table | targeted table |
Definition at line 2738 of file n_hash.c.
References __n_assert, and HASH_CLASSIC.
Referenced by ht_optimize().
char * ht_node_type | ( | HASH_NODE * | node | ) |
get the type of a node , text version
node | node to check |
Definition at line 1422 of file n_hash.c.
References __n_assert, and HASH_UNKNOWN.
Referenced by _ht_get_double(), _ht_get_double_trie(), _ht_get_int(), _ht_get_int_trie(), _ht_get_ptr(), _ht_get_ptr_trie(), _ht_get_string(), _ht_get_string_trie(), _ht_put_double(), _ht_put_int(), _ht_put_ptr(), _ht_put_string(), _ht_put_string_ptr(), ht_get_ptr_ex(), and ht_put_ptr_ex().
int ht_optimize | ( | HASH_TABLE ** | table | ) |
try an automatic optimization of the table
table | targeted table |
Definition at line 2881 of file n_hash.c.
References __n_assert, ht_get_optimal_size(), ht_get_table_collision_percentage(), and ht_resize().
void ht_print | ( | HASH_TABLE * | table | ) |
print contents of table
table | targeted hash table |
Definition at line 2407 of file n_hash.c.
References __n_assert, and ht_print.
Referenced by new_ht(), and new_ht_trie().
int ht_put_double | ( | HASH_TABLE * | table, |
const char * | key, | ||
double | value | ||
) |
put a double value with given key in the targeted hash table
table | targeted table |
key | key to retrieve |
value | double value to put |
Definition at line 2314 of file n_hash.c.
References __n_assert, and ht_put_double.
Referenced by new_ht(), and new_ht_trie().
int ht_put_int | ( | HASH_TABLE * | table, |
const char * | key, | ||
int | value | ||
) |
put an integral value with given key in the targeted hash table
table | targeted hash table |
key | associated value's key |
value | integral value to put |
Definition at line 2330 of file n_hash.c.
References __n_assert, and ht_put_int.
Referenced by new_ht(), and new_ht_trie().
int ht_put_ptr | ( | HASH_TABLE * | table, |
const char * | key, | ||
void * | ptr, | ||
void(*)(void *ptr) | destructor | ||
) |
put a pointer to the string value with given key in the targeted hash table
table | targeted hash table |
key | associated value's key |
ptr | pointer value to put |
destructor | the destructor func for ptr or NULL |
Definition at line 2347 of file n_hash.c.
References __n_assert, and ht_put_ptr.
Referenced by load_config_file(), netw_pool_add(), new_ht(), and new_ht_trie().
int ht_put_ptr_ex | ( | HASH_TABLE * | table, |
HASH_VALUE | hash_value, | ||
void * | val, | ||
void(*)(void *ptr) | destructor | ||
) |
put a pointer value with given key in the targeted hash table (HASH_CLASSIC only)
table | Targeted hash table |
hash_value | numerical hash key |
val | pointer value to put |
destructor | Pointer to the ptr type destructor function. Leave to NULL if there isn't |
Definition at line 2526 of file n_hash.c.
References __n_assert, _ht_node_destroy(), HASH_CLASSIC, HASH_PTR, ht_node_type(), list_foreach, list_push(), LOG_ERR, Malloc, n_log, and size.
int ht_put_string | ( | HASH_TABLE * | table, |
const char * | key, | ||
char * | string | ||
) |
put a string value (copy/dup) with given key in the targeted hash table
table | targeted hash table |
key | associated value's key |
string | string value to put (copy) |
Definition at line 2363 of file n_hash.c.
References __n_assert, and ht_put_string.
Referenced by _n_nodup_log(), _n_nodup_log_indexed(), new_ht(), and new_ht_trie().
int ht_put_string_ptr | ( | HASH_TABLE * | table, |
const char * | key, | ||
char * | string | ||
) |
put a string value (pointer) with given key in the targeted hash table
table | targeted hash table |
key | associated value's key |
string | string value to put (pointer) |
Definition at line 2379 of file n_hash.c.
References __n_assert, and ht_put_string_ptr.
Referenced by new_ht(), and new_ht_trie().
int ht_remove | ( | HASH_TABLE * | table, |
const char * | key | ||
) |
remove and delete node at key in table
table | targeted hash table |
key | key of node to destroy |
Definition at line 2394 of file n_hash.c.
References __n_assert, and ht_remove.
Referenced by netw_pool_remove(), new_ht(), and new_ht_trie().
int ht_remove_ex | ( | HASH_TABLE * | table, |
HASH_VALUE | hash_value | ||
) |
Remove a key from a hash table (HASH_CLASSIC only)
table | Targeted hash table |
hash_value | key pre computed numeric hash value |
Definition at line 2582 of file n_hash.c.
References __n_assert, _ht_node_destroy(), HASH_CLASSIC, list_foreach, LOG_ERR, n_log, remove_list_node, and size.
int ht_resize | ( | HASH_TABLE ** | table, |
size_t | size | ||
) |
rehash table according to size (HASH_CLASSIC mode only)
table | targeted table |
size | new hash table size |
Definition at line 2785 of file n_hash.c.
References __n_assert, Free, HT_FOREACH, list_destroy(), list_node_push(), list_node_shift(), LOG_ERR, n_log, new_generic_list(), and Realloc.
Referenced by ht_optimize().
LIST * ht_search | ( | HASH_TABLE * | table, |
int(*)(HASH_NODE *node) | node_is_matching | ||
) |
seach table for matching nodes
table | targeted hash table |
node_is_matching | matching function |
Definition at line 2422 of file n_hash.c.
References __n_assert, and ht_search().
Referenced by ht_get_completion_list(), ht_search(), new_ht(), and new_ht_trie().
int is_prime | ( | int | nb | ) |
test if number is a prime number or not
nb | number to test |
Definition at line 2690 of file n_hash.c.
Referenced by ht_get_optimal_size(), and next_prime().
void MurmurHash3_x64_128 | ( | const void * | key, |
const size_t | len, | ||
const uint64_t | seed, | ||
void * | out | ||
) |
MurmurHash3 was written by Austin Appleby, and is placed in the public domain.
The author hereby disclaims copyright to this source code. Note - The x86 and x64 versions do not produce the same results, as the algorithms are optimized for their respective platforms. You can still compile and run any of them on any platform, but your performance with the non-native version will be less than optimal.
key | char *string as the key |
len | size of the key |
seed | seed value for murmur hash |
out | generated hash |
Definition at line 1294 of file n_hash.c.
References BIG_CONSTANT, FALL_THROUGH, fmix64(), getblock64(), and ROTL64.
void MurmurHash3_x86_128 | ( | const void * | key, |
const int | len, | ||
uint32_t | seed, | ||
void * | out | ||
) |
MurmurHash3 was written by Austin Appleby, and is placed in the public domain.
The author hereby disclaims copyright to this source code. Note - The x86 and x64 versions do not produce the same results, as the algorithms are optimized for their respective platforms. You can still compile and run any of them on any platform, but your performance with the non-native version will be less than optimal.
key | char *string as the key |
len | size of the key |
seed | seed value for murmur hash |
out | generated hash |
Definition at line 1117 of file n_hash.c.
References FALL_THROUGH, fmix32(), getblock32(), and ROTL32.
void MurmurHash3_x86_32 | ( | const void * | key, |
int | len, | ||
uint32_t | seed, | ||
void * | out | ||
) |
MurmurHash3 was written by Austin Appleby, and is placed in the public domain.
The author hereby disclaims copyright to this source code. Note - The x86 and x64 versions do not produce the same results, as the algorithms are optimized for their respective platforms. You can still compile and run any of them on any platform, but your performance with the non-native version will be less than optimal.
key | char *string as the key |
len | size of the key |
seed | seed value for murmur hash |
out | generated hash |
Definition at line 1047 of file n_hash.c.
References FALL_THROUGH, fmix32(), getblock32(), and ROTL32.
HASH_TABLE * new_ht | ( | size_t | size | ) |
Create a hash table with the given size.
size | Size of the root hash node table |
Definition at line 2167 of file n_hash.c.
References __n_assert, _destroy_ht(), _empty_ht(), _ht_get_double(), _ht_get_int(), _ht_get_node(), _ht_get_ptr(), _ht_get_string(), _ht_print(), _ht_put_double(), _ht_put_int(), _ht_put_ptr(), _ht_put_string(), _ht_put_string_ptr(), _ht_remove(), _ht_search(), destroy_ht(), empty_ht(), Free, HASH_CLASSIC, ht_get_double(), ht_get_int(), ht_get_node(), ht_get_ptr(), ht_get_string(), ht_print(), ht_put_double(), ht_put_int(), ht_put_ptr(), ht_put_string(), ht_put_string_ptr(), ht_remove(), ht_search(), list_destroy(), LOG_ERR, Malloc, n_log, and new_generic_list().
Referenced by init_nodup_log(), load_config_file(), and netw_new_pool().
HASH_TABLE * new_ht_trie | ( | size_t | alphabet_length, |
size_t | alphabet_offset | ||
) |
create a TRIE hash table with the alphabet_size, each key value beeing decreased by alphabet_offset
alphabet_length | of the alphabet |
alphabet_offset | offset of each character in a key (i.e: to have 'a->z' with 'a' starting at zero, offset must be 32. |
Definition at line 2123 of file n_hash.c.
References __n_assert, _destroy_ht_trie(), _empty_ht_trie(), _ht_get_double_trie(), _ht_get_int_trie(), _ht_get_ptr_trie(), _ht_get_string_trie(), _ht_new_node_trie(), _ht_print_trie(), _ht_put_double_trie(), _ht_put_int_trie(), _ht_put_ptr_trie(), _ht_put_string_ptr_trie(), _ht_put_string_trie(), _ht_remove_trie(), _ht_search_trie(), destroy_ht(), empty_ht(), HASH_TRIE, ht_get_double(), ht_get_int(), ht_get_ptr(), ht_get_string(), ht_print(), ht_put_double(), ht_put_int(), ht_put_ptr(), ht_put_string(), ht_put_string_ptr(), ht_remove(), ht_search(), LOG_ERR, Malloc, and n_log.
int next_prime | ( | int | nb | ) |
compute next prime number after nb
nb | number to test |
Definition at line 2715 of file n_hash.c.
References is_prime(), and next_prime().
Referenced by ht_get_optimal_size(), and next_prime().