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

Evan Cheng evan.cheng at apple.com
Thu Apr 29 11:50:36 PDT 2010


Author: evancheng
Date: Thu Apr 29 13:50:35 2010
New Revision: 102652

URL: http://llvm.org/viewvc/llvm-project?rev=102652&view=rev
Log:
Add DenseMapInfo for int.

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=102652&r1=102651&r2=102652&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMapInfo.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMapInfo.h Thu Apr 29 13:50:35 2010
@@ -92,6 +92,16 @@
   }
 };
 
+// Provide DenseMapInfo for ints.
+template<> struct DenseMapInfo<int> {
+  static inline int getEmptyKey() { return 0x7fffffff; }
+  static inline int getTombstoneKey() { return -0x7fffffff - 1; }
+  static unsigned getHashValue(const int& Val) { return (unsigned)(Val * 37); }
+  static bool isEqual(const int& LHS, const int& RHS) {
+    return LHS == RHS;
+  }
+};
+
 // Provide DenseMapInfo for long longs.
 template<> struct DenseMapInfo<long long> {
   static inline long long getEmptyKey() { return 0x7fffffffffffffffLL; }





More information about the llvm-commits mailing list