summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-08-08 00:19:07 +0800
committerGitHub <noreply@github.com>2023-08-08 00:19:07 +0800
commit547ea5cc936e13deada0d14a3a5afd92e9ad438f (patch)
treedfa260b8e507f03f723779fcf6da53d491546e5e
parent846286bc8868cfd13bfad23288c25feab28c2a47 (diff)
Simplify SpvTypeInstKey (#3063)
-rw-r--r--source/slang/slang-emit-spirv.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp
index f63d2e417..f7d8a4ec6 100644
--- a/source/slang/slang-emit-spirv.cpp
+++ b/source/slang/slang-emit-spirv.cpp
@@ -972,21 +972,13 @@ struct SPIRVEmitContext
struct SpvTypeInstKey
{
List<SpvWord> words;
- bool operator==(const SpvTypeInstKey& other)
+ bool operator==(const SpvTypeInstKey& other) const { return words == other.words; }
+ const static bool kHasUniformHash = true;
+ auto getHashCode() const
{
- if (words.getCount() != other.words.getCount())
- return false;
- for (Index i = 0; i < words.getCount(); i++)
- if (words[i] != other.words[i])
- return false;
- return true;
- }
- HashCode getHashCode()
- {
- HashCode result = 0;
- for (auto word : words)
- result = combineHash(result, word);
- return result;
+ return Slang::getHashCode(
+ reinterpret_cast<const char*>(words.getBuffer()),
+ words.getCount() * sizeof(SpvWord));
}
};