From: Chandler Carruth Date: Sun, 31 Oct 2010 22:57:03 +0000 (+0000) Subject: Add a specialization for 'long', a hole in the set of fundamental X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=25592eb52c39097bc610785f648aca4a09989201;p=oota-llvm.git Add a specialization for 'long', a hole in the set of fundamental specializations provided here. This is a little annoying because its size changes from platform to platform. If possible, I may follow up with a patch that uses standard constants to simplify much of this, but assuming for now that was avoided for a reason. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117880 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/DenseMapInfo.h b/include/llvm/ADT/DenseMapInfo.h index 52993869927..25e341bf4fd 100644 --- a/include/llvm/ADT/DenseMapInfo.h +++ b/include/llvm/ADT/DenseMapInfo.h @@ -102,6 +102,20 @@ template<> struct DenseMapInfo { } }; +// Provide DenseMapInfo for longs. +template<> struct DenseMapInfo { + static inline long getEmptyKey() { + return (1UL << (sizeof(long) * 8 - 1)) - 1L; + } + static inline long getTombstoneKey() { return getEmptyKey() - 1L; } + static unsigned getHashValue(const long& Val) { + return (unsigned)(Val * 37L); + } + static bool isEqual(const long& LHS, const long& RHS) { + return LHS == RHS; + } +}; + // Provide DenseMapInfo for long longs. template<> struct DenseMapInfo { static inline long long getEmptyKey() { return 0x7fffffffffffffffLL; }