30 return cfloor(a / _threshold + 0.5f) < cfloor(b / _threshold + 0.5f);
39 return (a.compare_to(b) < 0);
48 return (a.compare_to(b) == 0);
57 return (a != b && (*a) < (*b));
66 return (a != b && (*a).compare_to(*b) < 0);
75 return (a == b || (*a).compare_to(*b) == 0);
84 return (a != b && (*a).get_name() < (*b).get_name());
93 return (a == b || (*a).get_name() == (*b).get_name());
99 template<
class Key,
class Compare>
102 uint32_t key32 = (uint32_t)(key);
112 uint32_t key32 = (uint32_t)reinterpret_cast<uintptr_t>(key);
122 _threshold(threshold)
132 return add_hash(0, key);
141 return cfloor(a / _threshold + 0.5f) < cfloor(b / _threshold + 0.5f);
150 uint32_t key32 = (uint32_t)(key / _threshold + 0.5f);
157 template<
class Key,
class Compare>
160 return add_hash(0, key);
166 template<
class Key,
class Compare>
171 if (key.size() > 0) {
172 assert(&key[key.size() - 1] - &key[0] == (ptrdiff_t)key.size() - 1);
175 size_t num_bytes = (key.size() *
sizeof(key[0]));
182 template<
class Key,
class Compare>
185 return key.get_hash();
191 template<
class Key,
class Compare>
194 return (*key).get_hash();
203 return (*key).get_hash();
212 return (a == b || (*a) == (*b));
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
static size_t add_hash(size_t start, const void *key)
Adds the indicated key into a running hash.
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
static size_t add_hash(size_t start, const uint32_t *words, size_t num_words)
Adds a linear sequence of uint32 words to the hash.
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
This hash_compare class hashes a float or a double.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
size_t operator()(const Key &key) const
Computes a size_t hash from the float.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
size_t operator()(const Key &key) const
Trivially computes a size_t hash from the components of the string.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
Compares two floating point numbers, within threshold of equivalence.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
size_t add_hash(size_t start, const Key &key) const
Adds the indicated key into a running hash.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equal to b, false otherwise.
static size_t add_hash(size_t start, const Key &key)
Adds the elements of the indicated key into a running hash.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.