summaryrefslogtreecommitdiff
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-hash.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/core/slang-hash.h b/source/core/slang-hash.h
index 8c4fbac42..bc4b30ccc 100644
--- a/source/core/slang-hash.h
+++ b/source/core/slang-hash.h
@@ -164,6 +164,13 @@ namespace Slang
return PointerHash<std::is_pointer<TKey>::value>::getHashCode(key);
}
+ template<typename TKey>
+ HashCode getHashCodeBytewise(const TKey& t)
+ {
+ static_assert(std::has_unique_object_representations_v<TKey>);
+ return getHashCode(reinterpret_cast<const char*>(&t), sizeof(TKey));
+ }
+
inline HashCode combineHash(HashCode left, HashCode right)
{
return (left * 16777619) ^ right;