14#ifndef WPIUTIL_WPI_DENSEMAPINFO_H
15#define WPIUTIL_WPI_DENSEMAPINFO_H
30 uint64_t key = (uint64_t)a << 32 | (uint64_t)
b;
49template<
typename T,
typename Enable =
void>
73 return reinterpret_cast<T*
>(Val);
79 return reinterpret_cast<T*
>(Val);
83 return (
unsigned((
uintptr_t)PtrVal) >> 4) ^
87 static bool isEqual(
const T *LHS,
const T *RHS) {
return LHS == RHS; }
94 static unsigned getHashValue(
const char& Val) {
return Val * 37U; }
96 static bool isEqual(
const char &LHS,
const char &RHS) {
105 static unsigned getHashValue(
const unsigned char &Val) {
return Val * 37U; }
107 static bool isEqual(
const unsigned char &LHS,
const unsigned char &RHS) {
116 static unsigned getHashValue(
const unsigned short &Val) {
return Val * 37U; }
118 static bool isEqual(
const unsigned short &LHS,
const unsigned short &RHS) {
127 static unsigned getHashValue(
const unsigned& Val) {
return Val * 37U; }
129 static bool isEqual(
const unsigned& LHS,
const unsigned& RHS) {
140 return (
unsigned)(Val * 37UL);
143 static bool isEqual(
const unsigned long& LHS,
const unsigned long& RHS) {
154 return (
unsigned)(Val * 37ULL);
157 static bool isEqual(
const unsigned long long& LHS,
158 const unsigned long long& RHS) {
168 static bool isEqual(
const short &LHS,
const short &RHS) {
return LHS == RHS; }
175 static unsigned getHashValue(
const int& Val) {
return (
unsigned)(Val * 37U); }
177 static bool isEqual(
const int& LHS,
const int& RHS) {
185 return (1UL << (
sizeof(
long) * 8 - 1)) - 1UL;
191 return (
unsigned)(Val * 37UL);
194 static bool isEqual(
const long& LHS,
const long& RHS) {
201 static inline long long getEmptyKey() {
return 0x7fffffffffffffffLL; }
205 return (
unsigned)(Val * 37ULL);
209 const long long& RHS) {
215template<
typename T,
typename U>
222 return std::make_pair(FirstInfo::getEmptyKey(),
223 SecondInfo::getEmptyKey());
227 return std::make_pair(FirstInfo::getTombstoneKey(),
228 SecondInfo::getTombstoneKey());
233 SecondInfo::getHashValue(PairVal.second));
241 SecondInfo::getHashValue(Second));
245 return FirstInfo::isEqual(LHS.first, RHS.first) &&
246 SecondInfo::isEqual(LHS.second, RHS.second);
262 template <
unsigned I>
264 using EltType = std::tuple_element_t<I, Tuple>;
265 std::integral_constant<bool, I + 1 ==
sizeof...(Ts)> atEnd;
268 getHashValueImpl<I + 1>(values, atEnd));
271 template <
unsigned I>
277 std::integral_constant<bool, 0 ==
sizeof...(Ts)> atEnd;
278 return getHashValueImpl<0>(values, atEnd);
281 template <
unsigned I>
283 using EltType = std::tuple_element_t<I, Tuple>;
284 std::integral_constant<bool, I + 1 ==
sizeof...(Ts)> atEnd;
286 isEqualImpl<I + 1>(lhs, rhs, atEnd);
289 template <
unsigned I>
295 std::integral_constant<bool, 0 ==
sizeof...(Ts)> atEnd;
296 return isEqualImpl<0>(lhs, rhs, atEnd);
detail namespace with internal helper functions
Definition: xchar.h:20
uint128_t uintptr_t
Definition: format.h:484
static unsigned combineHashValue(unsigned a, unsigned b)
Simplistic combination of 32-bit hash values into 32-bit hash values.
Definition: DenseMapInfo.h:29
Definition: ntcore_cpp.h:26
static T * getTombstoneKey()
Definition: DenseMapInfo.h:76
static T * getEmptyKey()
Definition: DenseMapInfo.h:70
static unsigned getHashValue(const T *PtrVal)
Definition: DenseMapInfo.h:82
static bool isEqual(const T *LHS, const T *RHS)
Definition: DenseMapInfo.h:87
static char getTombstoneKey()
Definition: DenseMapInfo.h:93
static char getEmptyKey()
Definition: DenseMapInfo.h:92
static bool isEqual(const char &LHS, const char &RHS)
Definition: DenseMapInfo.h:96
static unsigned getHashValue(const char &Val)
Definition: DenseMapInfo.h:94
static unsigned getHashValue(const int &Val)
Definition: DenseMapInfo.h:175
static int getEmptyKey()
Definition: DenseMapInfo.h:173
static bool isEqual(const int &LHS, const int &RHS)
Definition: DenseMapInfo.h:177
static int getTombstoneKey()
Definition: DenseMapInfo.h:174
static unsigned getHashValue(const long &Val)
Definition: DenseMapInfo.h:190
static long getEmptyKey()
Definition: DenseMapInfo.h:184
static long getTombstoneKey()
Definition: DenseMapInfo.h:188
static bool isEqual(const long &LHS, const long &RHS)
Definition: DenseMapInfo.h:194
static long long getTombstoneKey()
Definition: DenseMapInfo.h:202
static bool isEqual(const long long &LHS, const long long &RHS)
Definition: DenseMapInfo.h:208
static unsigned getHashValue(const long long &Val)
Definition: DenseMapInfo.h:204
static long long getEmptyKey()
Definition: DenseMapInfo.h:201
static short getEmptyKey()
Definition: DenseMapInfo.h:165
static unsigned getHashValue(const short &Val)
Definition: DenseMapInfo.h:167
static short getTombstoneKey()
Definition: DenseMapInfo.h:166
static bool isEqual(const short &LHS, const short &RHS)
Definition: DenseMapInfo.h:168
static Pair getTombstoneKey()
Definition: DenseMapInfo.h:226
static bool isEqual(const Pair &LHS, const Pair &RHS)
Definition: DenseMapInfo.h:244
static Pair getEmptyKey()
Definition: DenseMapInfo.h:221
static unsigned getHashValue(const Pair &PairVal)
Definition: DenseMapInfo.h:231
static unsigned getHashValuePiecewise(const T &First, const U &Second)
Definition: DenseMapInfo.h:239
std::pair< T, U > Pair
Definition: DenseMapInfo.h:217
static bool isEqualImpl(const Tuple &, const Tuple &, std::true_type)
Definition: DenseMapInfo.h:290
std::tuple< Ts... > Tuple
Definition: DenseMapInfo.h:252
static Tuple getEmptyKey()
Definition: DenseMapInfo.h:254
static unsigned getHashValueImpl(const Tuple &values, std::false_type)
Definition: DenseMapInfo.h:263
static unsigned getHashValueImpl(const Tuple &, std::true_type)
Definition: DenseMapInfo.h:272
static unsigned getHashValue(const std::tuple< Ts... > &values)
Definition: DenseMapInfo.h:276
static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type)
Definition: DenseMapInfo.h:282
static bool isEqual(const Tuple &lhs, const Tuple &rhs)
Definition: DenseMapInfo.h:294
static Tuple getTombstoneKey()
Definition: DenseMapInfo.h:258
static unsigned getEmptyKey()
Definition: DenseMapInfo.h:125
static unsigned getHashValue(const unsigned &Val)
Definition: DenseMapInfo.h:127
static unsigned getTombstoneKey()
Definition: DenseMapInfo.h:126
static bool isEqual(const unsigned &LHS, const unsigned &RHS)
Definition: DenseMapInfo.h:129
static bool isEqual(const unsigned char &LHS, const unsigned char &RHS)
Definition: DenseMapInfo.h:107
static unsigned char getEmptyKey()
Definition: DenseMapInfo.h:103
static unsigned char getTombstoneKey()
Definition: DenseMapInfo.h:104
static unsigned getHashValue(const unsigned char &Val)
Definition: DenseMapInfo.h:105
static unsigned long getEmptyKey()
Definition: DenseMapInfo.h:136
static bool isEqual(const unsigned long &LHS, const unsigned long &RHS)
Definition: DenseMapInfo.h:143
static unsigned getHashValue(const unsigned long &Val)
Definition: DenseMapInfo.h:139
static unsigned long getTombstoneKey()
Definition: DenseMapInfo.h:137
static unsigned long long getTombstoneKey()
Definition: DenseMapInfo.h:151
static unsigned long long getEmptyKey()
Definition: DenseMapInfo.h:150
static unsigned getHashValue(const unsigned long long &Val)
Definition: DenseMapInfo.h:153
static bool isEqual(const unsigned long long &LHS, const unsigned long long &RHS)
Definition: DenseMapInfo.h:157
static unsigned short getEmptyKey()
Definition: DenseMapInfo.h:114
static unsigned getHashValue(const unsigned short &Val)
Definition: DenseMapInfo.h:116
static unsigned short getTombstoneKey()
Definition: DenseMapInfo.h:115
static bool isEqual(const unsigned short &LHS, const unsigned short &RHS)
Definition: DenseMapInfo.h:118
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: DenseMapInfo.h:50