Add DenseMapInfo for signed long long.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 22 Jan 2010 03:33:01 +0000 (03:33 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 22 Jan 2010 03:33:01 +0000 (03:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94146 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/DenseMapInfo.h

index 6b494ef5d0338c582893a15874cb1c95cba8bbc0..41197a1e12df951d5938060d0088b9298190fdae 100644 (file)
@@ -92,6 +92,19 @@ template<> struct DenseMapInfo<unsigned long long> {
   }
 };
 
+// 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> > {