Skip to content

Commit

Permalink
Add preprocessor macro GTL_DISABLE_MIX to disable hash mixing. (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp authored Nov 2, 2024
1 parent 2886f96 commit b19d1a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/gtl/phmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2520,7 +2520,11 @@ class raw_hash_set {
struct HashElement {
template<class K, class... Args>
size_t operator()(const K& key, Args&&...) const {
#if GTL_DISABLE_MIX
return h(key);
#else
return phmap_mix<sizeof(size_t)>()(static_cast<size_t>(h(key)));
#endif
}
const hasher& h;
};
Expand Down Expand Up @@ -4309,7 +4313,11 @@ class parallel_hash_set {
struct HashElement {
template<class K, class... Args>
size_t operator()(const K& key, Args&&...) const {
#if GTL_DISABLE_MIX
return h(key);
#else
return phmap_mix<sizeof(size_t)>()(h(key));
#endif
}
const hasher& h;
};
Expand Down

0 comments on commit b19d1a7

Please sign in to comment.