tint/utils: Reduce cost of HashCombine
Do less shufflin' for faster hashin'
Change-Id: Ieb6bd960aee4e7a351f4f87249cde96606f835e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110561
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/utils/hash.h b/src/tint/utils/hash.h
index 196861b..8c9dd25 100644
--- a/src/tint/utils/hash.h
+++ b/src/tint/utils/hash.h
@@ -164,7 +164,7 @@
template <typename... ARGS>
size_t HashCombine(size_t hash, const ARGS&... values) {
constexpr size_t offset = detail::HashCombineOffset<sizeof(size_t)>::value();
- ((hash ^= Hash(values) + offset + (hash << 6) + (hash >> 2)), ...);
+ ((hash ^= Hash(values) + (offset ^ (hash >> 2))), ...);
return hash;
}