aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-04-29 18:50:35 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-04-29 18:50:35 +0000
commit3e6fe5ec17217169cd95ee86515955f7726db008 (patch)
tree9d54830166bf41608fe7a7830e16dfa20ad886e7 /include/llvm
parent281ead4da62e34238bdb5407c13e9e1fc65441fb (diff)
downloadexternal_llvm-3e6fe5ec17217169cd95ee86515955f7726db008.zip
external_llvm-3e6fe5ec17217169cd95ee86515955f7726db008.tar.gz
external_llvm-3e6fe5ec17217169cd95ee86515955f7726db008.tar.bz2
Add DenseMapInfo for int.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/DenseMapInfo.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/ADT/DenseMapInfo.h b/include/llvm/ADT/DenseMapInfo.h
index 41197a1..5299386 100644
--- a/include/llvm/ADT/DenseMapInfo.h
+++ b/include/llvm/ADT/DenseMapInfo.h
@@ -92,6 +92,16 @@ template<> struct DenseMapInfo<unsigned long long> {
}
};
+// 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; }