17 #if !defined(__FLECSI_PRIVATE__) 18 #error Do not include this file directly! 32 template<
class KEY,
class TYPE>
40 static constexpr
size_t hash_bits_ = 22;
42 static constexpr
size_t hash_capacity_ = 1 << hash_bits_;
44 static constexpr
size_t hash_mask_ = (1 << hash_bits_) - 1;
45 static constexpr
size_t modulo = 5;
47 static size_t collision;
56 type_t * ptr = index_space.storage()->begin() + h;
57 while(ptr->key() != key && ptr->key() != key_t::null()) {
59 h = h >= hash_capacity_ ? h % hash_capacity_ : h;
60 ptr = index_space.storage()->begin() + h;
62 if(ptr->key() != key) {
73 template<
typename S,
class... ARGS>
76 type_t * ptr = index_space.storage()->begin() + h;
77 while(ptr->key() != key && ptr->key() != key_t::null()) {
79 h = h >= hash_capacity_ ? h % hash_capacity_ : h;
80 ptr = index_space.storage()->begin() + h;
83 auto b =
new(ptr) type_t(key, std::forward<ARGS>(args)...);
91 static size_t hash(
const key_t & key) {
92 return key & hash_mask_;
96 template<
class K,
class T>
static size_t hash(const key_t &key)
the Hash function transforming a key in position in the hash table.
Definition: hash_table.hh:91
static type_t * find(S &index_space, key_t key)
Find a value in the hashtable While the value or a null key is not found we keep looping.
Definition: hash_table.hh:54
static type_t * insert(S &index_space, const key_t &key, ARGS &&... args)
Insert an object in the hash map at a defined position This function tries to find the first availabl...
Definition: hash_table.hh:74
Definition: hash_table.hh:33
Definition: index_space.hh:85
Definition: control.hh:31