Skip to content

Commit

Permalink
Add preprocessor macro GTL_DISABLE_MIX to disable hash mixing.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Nov 2, 2024
1 parent e33ed00 commit 1ec7500
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 @@ -2524,7 +2524,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 @@ -4313,7 +4317,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 1ec7500

Please sign in to comment.