From: Evan Cheng Date: Thu, 29 Apr 2010 18:50:35 +0000 (+0000) Subject: Add DenseMapInfo for int. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3e6fe5ec17217169cd95ee86515955f7726db008;p=oota-llvm.git Add DenseMapInfo for int. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102652 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/DenseMapInfo.h b/include/llvm/ADT/DenseMapInfo.h index 41197a1e12d..52993869927 100644 --- a/include/llvm/ADT/DenseMapInfo.h +++ b/include/llvm/ADT/DenseMapInfo.h @@ -92,6 +92,16 @@ template<> struct DenseMapInfo { } }; +// Provide DenseMapInfo for ints. +template<> struct DenseMapInfo { + 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 { static inline long long getEmptyKey() { return 0x7fffffffffffffffLL; }