59#ifndef DOXYGEN_SHOULD_SKIP_THIS
72 for (
Size nbb = nb; nbb >
Size(1); ++i, nbb >>= 1) {}
77 if ((i ==
sizeof(
Size) * 8 - 1) && (power_two < nb)) {
78 GUM_ERROR(OutOfBounds,
"HashTable size " << nb <<
" is too large");
81 return (power_two < nb ? i +
Size(1) : i);
90 const char* char_ptr = key.c_str();
91 const Size* int_ptr = (
const Size*)char_ptr;
93 for (; size >=
sizeof(
Size); size -=
sizeof(
Size), ++int_ptr) {
97 for (char_ptr = (
const char*)int_ptr; size !=
Size(0); --size, ++char_ptr) {
106 return castToSize(key) & this->hash_mask_;
113 const char* char_ptr = key.data();
114 const Size* int_ptr = (
const Size*)char_ptr;
116 for (; size >=
sizeof(
Size); size -=
sizeof(
Size), ++int_ptr) {
120 for (char_ptr = (
const char*)int_ptr; size !=
Size(0); --size, ++char_ptr) {
129 return castToSize(key) & this->hash_mask_;
138 for (
Size i =
Size(0); i < size; ++i)
139 h += i *
Size(key[i]);
155 for (
Size i =
Size(0), j =
Size(key.size()); i < j; ++i)
Size operator()(const Debug &key) const final
Computes the hashed value of a key.
static Size castToSize(const Debug &key)
Returns the value of a key as a Size.
static Size castToSize(const std::string &key)
Returns the value of a key as a Size.
Size operator()(const std::string &key) const final
Computes the hashed value of a key.
This class should be useless as only its specializations should be used.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
unsigned int _hashTableLog2_(const Size nb)
Returns the size in bits - 1 necessary to store the smallest power of 2 greater than or equal to nb.
Classes providing basic hash functions for hash tables.
gum is the global namespace for all aGrUM entities
static constexpr Size gold