summaryrefslogtreecommitdiff
path: root/source/core/slang-hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-hash.h')
-rw-r--r--source/core/slang-hash.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/core/slang-hash.h b/source/core/slang-hash.h
index 49685ee65..9a173c4f8 100644
--- a/source/core/slang-hash.h
+++ b/source/core/slang-hash.h
@@ -147,6 +147,20 @@ namespace Slang
return ::Slang::hashObjectBytes(*this); \
}
+# define SLANG_COMPONENTWISE_HASHABLE_1 \
+ auto getHashCode() const \
+ { \
+ const auto& [m1] = *this; \
+ return Slang::getHashCode(m1); \
+ }
+
+# define SLANG_COMPONENTWISE_HASHABLE_2 \
+ auto getHashCode() const \
+ { \
+ const auto& [m1, m2] = *this; \
+ return combineHash(::Slang::getHashCode(m1), ::Slang::getHashCode(m2)); \
+ }
+
inline HashCode64 combineHash(HashCode64 h)
{
return h;