[llvm] [ADT] Update hash function of uint64_t for DenseMap (PR #95734)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 12:53:20 PDT 2024


================
@@ -137,7 +137,10 @@ template<> struct DenseMapInfo<unsigned long> {
   static inline unsigned long getTombstoneKey() { return ~0UL - 1L; }
 
   static unsigned getHashValue(const unsigned long& Val) {
-    return (unsigned)(Val * 37UL);
+    if constexpr (sizeof(Val) == 4)
----------------
nikic wrote:

I think it's best to keep the conditional so you get the same hashing behavior if you use a different spelling for what is essentially the same type.

https://github.com/llvm/llvm-project/pull/95734


More information about the llvm-commits mailing list