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

Anton Korobeynikov via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 21:51:54 PDT 2024


================
@@ -151,7 +151,7 @@ template<> struct DenseMapInfo<unsigned long long> {
   static inline unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; }
 
   static unsigned getHashValue(const unsigned long long& Val) {
-    return (unsigned)(Val * 37ULL);
+    return DenseMapInfo<unsigned>(Val) ^ DenseMapInfo<unsigned>(Val >> 32);
----------------
asl wrote:

Can we just use some code from `ADT/Hashing.h`? It seems to contain some well-mixing routines. Seems like something like `llvm::hash_value(Val)` would be enough.

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


More information about the llvm-commits mailing list