Add DenseMapInfo for int.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102652 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2010-04-29 18:50:35 +00:00
parent 281ead4da6
commit 3e6fe5ec17

View File

@ -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; }