summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-05-19 12:40:27 -0700
committerGitHub <noreply@github.com>2023-05-19 12:40:27 -0700
commit97178d08d4a20d2a5e3a6be813fc6a7079ef86e1 (patch)
tree0147e5d678d9ed74419c4b1721e696c17682b6dd /src/support
parentb7b1d0df29df14634d2c680d1d2c351b624b4fbb (diff)
downloadbinaryen-97178d08d4a20d2a5e3a6be813fc6a7079ef86e1.tar.gz
binaryen-97178d08d4a20d2a5e3a6be813fc6a7079ef86e1.tar.bz2
binaryen-97178d08d4a20d2a5e3a6be813fc6a7079ef86e1.zip
TypeSSA: Handle collisions by adding a hash to ensure a fresh rec group (#5724)
Fixes #5720
Diffstat (limited to 'src/support')
-rw-r--r--src/support/hash.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/support/hash.h b/src/support/hash.h
index fc8b358f2..b99902616 100644
--- a/src/support/hash.h
+++ b/src/support/hash.h
@@ -28,7 +28,10 @@ template<typename T> inline std::size_t hash(const T& value) {
}
// Combines two digests into the first digest. Use instead of `rehash` if
-// `otherDigest` is another digest and not a `size_t` value.
+// `otherDigest` is another digest and not a `size_t` value. This is also useful
+// when you want deterministic behavior across systems, as this method does not
+// call std::hash, so it does not depend on the behavior of the local machine's
+// C++ standard library implementation.
inline void hash_combine(std::size_t& digest, const std::size_t otherDigest) {
// see: boost/container_hash/hash.hpp
// The constant is the N-bits reciprocal of the golden ratio: