From 547ea5cc936e13deada0d14a3a5afd92e9ad438f Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 8 Aug 2023 00:19:07 +0800 Subject: Simplify SpvTypeInstKey (#3063) --- source/slang/slang-emit-spirv.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'source') 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 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(words.getBuffer()), + words.getCount() * sizeof(SpvWord)); } }; -- cgit v1.2.3