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

Evan Cheng evan.cheng at apple.com
Thu Jan 21 19:33:01 PST 2010


Author: evancheng
Date: Thu Jan 21 21:33:01 2010
New Revision: 94146

URL: http://llvm.org/viewvc/llvm-project?rev=94146&view=rev
Log:
Add DenseMapInfo for signed long long.

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=94146&r1=94145&r2=94146&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMapInfo.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMapInfo.h Thu Jan 21 21:33:01 2010
@@ -92,6 +92,19 @@
   }
 };
 
+// Provide DenseMapInfo for long longs.
+template<> struct DenseMapInfo<long long> {
+  static inline long long getEmptyKey() { return 0x7fffffffffffffffLL; }
+  static inline long long getTombstoneKey() { return -0x7fffffffffffffffLL-1; }
+  static unsigned getHashValue(const long long& Val) {
+    return (unsigned)(Val * 37LL);
+  }
+  static bool isEqual(const long long& LHS,
+                      const 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