[llvm-commits] [llvm] r80118 - /llvm/trunk/include/llvm/ADT/DenseMapInfo.h

Mike Stump mrs at apple.com
Wed Aug 26 11:02:20 PDT 2009


Author: mrs
Date: Wed Aug 26 13:02:19 2009
New Revision: 80118

URL: http://llvm.org/viewvc/llvm-project?rev=80118&view=rev
Log:
Allow unsigned long long DenseMapInfo.

Modified:
    llvm/trunk/include/llvm/ADT/DenseMapInfo.h

Modified: llvm/trunk/include/llvm/ADT/DenseMapInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMapInfo.h?rev=80118&r1=80117&r2=80118&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMapInfo.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMapInfo.h Wed Aug 26 13:02:19 2009
@@ -84,6 +84,20 @@
   }
 };
 
+// Provide DenseMapInfo for unsigned long longs.
+template<> struct DenseMapInfo<unsigned long long> {
+  static inline unsigned long long getEmptyKey() { return ~0LL; }
+  static inline unsigned long long getTombstoneKey() { return ~0LL - 1LL; }
+  static unsigned getHashValue(const unsigned long long& Val) {
+    return (unsigned)(Val * 37LL);
+  }
+  static bool isPod() { return true; }
+  static bool isEqual(const unsigned long long& LHS,
+                      const unsigned long long& RHS) {
+  return LHS == RHS;
+  }
+};
+
 // Provide DenseMapInfo for all pairs whose members have info.
 template<typename T, typename U>
 struct DenseMapInfo<std::pair<T, U> > {





More information about the llvm-commits mailing list