14#ifndef WPIUTIL_WPI_DENSEMAPINFO_H
15#define WPIUTIL_WPI_DENSEMAPINFO_H
48template<
typename T,
typename Enable =
void>
72 return reinterpret_cast<T*
>(Val);
78 return reinterpret_cast<T*
>(Val);
82 return (
unsigned((
uintptr_t)PtrVal) >> 4) ^
86 static bool isEqual(
const T *LHS,
const T *RHS) {
return LHS == RHS; }
93 static unsigned getHashValue(
const char& Val) {
return Val * 37U; }
95 static bool isEqual(
const char &LHS,
const char &RHS) {
104 static unsigned getHashValue(
const unsigned char &Val) {
return Val * 37U; }
106 static bool isEqual(
const unsigned char &LHS,
const unsigned char &RHS) {
115 static unsigned getHashValue(
const unsigned short &Val) {
return Val * 37U; }
117 static bool isEqual(
const unsigned short &LHS,
const unsigned short &RHS) {
126 static unsigned getHashValue(
const unsigned& Val) {
return Val * 37U; }
128 static bool isEqual(
const unsigned& LHS,
const unsigned& RHS) {
139 return (
unsigned)(Val * 37UL);
142 static bool isEqual(
const unsigned long& LHS,
const unsigned long& RHS) {
153 return (
unsigned)(Val * 37ULL);
156 static bool isEqual(
const unsigned long long& LHS,
157 const unsigned long long& RHS) {
167 static bool isEqual(
const short &LHS,
const short &RHS) {
return LHS == RHS; }
174 static unsigned getHashValue(
const int& Val) {
return (
unsigned)(Val * 37U); }
176 static bool isEqual(
const int& LHS,
const int& RHS) {
184 return (1UL << (
sizeof(
long) * 8 - 1)) - 1UL;
190 return (
unsigned)(Val * 37UL);
193 static bool isEqual(
const long& LHS,
const long& RHS) {
200 static inline long long getEmptyKey() {
return 0x7fffffffffffffffLL; }
204 return (
unsigned)(Val * 37ULL);
208 const long long& RHS) {
214template<
typename T,
typename U>
221 return std::make_pair(FirstInfo::getEmptyKey(),
222 SecondInfo::getEmptyKey());
226 return std::make_pair(FirstInfo::getTombstoneKey(),
227 SecondInfo::getTombstoneKey());
232 SecondInfo::getHashValue(PairVal.second));
236 return FirstInfo::isEqual(LHS.first, RHS.first) &&
237 SecondInfo::isEqual(LHS.second, RHS.second);
253 template <
unsigned I>
256 std::integral_constant<bool, I + 1 ==
sizeof...(Ts)> atEnd;
259 getHashValueImpl<I + 1>(values, atEnd));
262 template <
unsigned I>
268 std::integral_constant<bool, 0 ==
sizeof...(Ts)> atEnd;
269 return getHashValueImpl<0>(values, atEnd);
272 template <
unsigned I>
275 std::integral_constant<bool, I + 1 ==
sizeof...(Ts)> atEnd;
277 isEqualImpl<I + 1>(lhs, rhs, atEnd);
280 template <
unsigned I>
286 std::integral_constant<bool, 0 ==
sizeof...(Ts)> atEnd;
287 return isEqualImpl<0>(lhs, rhs, atEnd);
type
Definition: core.h:575
::uint64_t uint64_t
Definition: Meta.h:58
Definition: format-inl.h:32
uint128_t uintptr_t
Definition: format.h:432
Definition: BFloat16.h:88
static unsigned combineHashValue(unsigned a, unsigned b)
Simplistic combination of 32-bit hash values into 32-bit hash values.
Definition: DenseMapInfo.h:28
Definition: AprilTagFieldLayout.h:18
static T * getTombstoneKey()
Definition: DenseMapInfo.h:75
static T * getEmptyKey()
Definition: DenseMapInfo.h:69
static unsigned getHashValue(const T *PtrVal)
Definition: DenseMapInfo.h:81
static bool isEqual(const T *LHS, const T *RHS)
Definition: DenseMapInfo.h:86
static char getTombstoneKey()
Definition: DenseMapInfo.h:92
static char getEmptyKey()
Definition: DenseMapInfo.h:91
static bool isEqual(const char &LHS, const char &RHS)
Definition: DenseMapInfo.h:95
static unsigned getHashValue(const char &Val)
Definition: DenseMapInfo.h:93
static unsigned getHashValue(const int &Val)
Definition: DenseMapInfo.h:174
static int getEmptyKey()
Definition: DenseMapInfo.h:172
static bool isEqual(const int &LHS, const int &RHS)
Definition: DenseMapInfo.h:176
static int getTombstoneKey()
Definition: DenseMapInfo.h:173
static unsigned getHashValue(const long &Val)
Definition: DenseMapInfo.h:189
static long getEmptyKey()
Definition: DenseMapInfo.h:183
static long getTombstoneKey()
Definition: DenseMapInfo.h:187
static bool isEqual(const long &LHS, const long &RHS)
Definition: DenseMapInfo.h:193
static long long getTombstoneKey()
Definition: DenseMapInfo.h:201
static bool isEqual(const long long &LHS, const long long &RHS)
Definition: DenseMapInfo.h:207
static unsigned getHashValue(const long long &Val)
Definition: DenseMapInfo.h:203
static long long getEmptyKey()
Definition: DenseMapInfo.h:200
static short getEmptyKey()
Definition: DenseMapInfo.h:164
static unsigned getHashValue(const short &Val)
Definition: DenseMapInfo.h:166
static short getTombstoneKey()
Definition: DenseMapInfo.h:165
static bool isEqual(const short &LHS, const short &RHS)
Definition: DenseMapInfo.h:167
static Pair getTombstoneKey()
Definition: DenseMapInfo.h:225
static bool isEqual(const Pair &LHS, const Pair &RHS)
Definition: DenseMapInfo.h:235
static Pair getEmptyKey()
Definition: DenseMapInfo.h:220
static unsigned getHashValue(const Pair &PairVal)
Definition: DenseMapInfo.h:230
std::pair< T, U > Pair
Definition: DenseMapInfo.h:216
static bool isEqualImpl(const Tuple &, const Tuple &, std::true_type)
Definition: DenseMapInfo.h:281
std::tuple< Ts... > Tuple
Definition: DenseMapInfo.h:243
static Tuple getEmptyKey()
Definition: DenseMapInfo.h:245
static unsigned getHashValueImpl(const Tuple &values, std::false_type)
Definition: DenseMapInfo.h:254
static unsigned getHashValueImpl(const Tuple &, std::true_type)
Definition: DenseMapInfo.h:263
static unsigned getHashValue(const std::tuple< Ts... > &values)
Definition: DenseMapInfo.h:267
static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type)
Definition: DenseMapInfo.h:273
static bool isEqual(const Tuple &lhs, const Tuple &rhs)
Definition: DenseMapInfo.h:285
static Tuple getTombstoneKey()
Definition: DenseMapInfo.h:249
static unsigned getEmptyKey()
Definition: DenseMapInfo.h:124
static unsigned getHashValue(const unsigned &Val)
Definition: DenseMapInfo.h:126
static unsigned getTombstoneKey()
Definition: DenseMapInfo.h:125
static bool isEqual(const unsigned &LHS, const unsigned &RHS)
Definition: DenseMapInfo.h:128
static bool isEqual(const unsigned char &LHS, const unsigned char &RHS)
Definition: DenseMapInfo.h:106
static unsigned char getEmptyKey()
Definition: DenseMapInfo.h:102
static unsigned char getTombstoneKey()
Definition: DenseMapInfo.h:103
static unsigned getHashValue(const unsigned char &Val)
Definition: DenseMapInfo.h:104
static unsigned long getEmptyKey()
Definition: DenseMapInfo.h:135
static bool isEqual(const unsigned long &LHS, const unsigned long &RHS)
Definition: DenseMapInfo.h:142
static unsigned getHashValue(const unsigned long &Val)
Definition: DenseMapInfo.h:138
static unsigned long getTombstoneKey()
Definition: DenseMapInfo.h:136
static unsigned long long getTombstoneKey()
Definition: DenseMapInfo.h:150
static unsigned long long getEmptyKey()
Definition: DenseMapInfo.h:149
static unsigned getHashValue(const unsigned long long &Val)
Definition: DenseMapInfo.h:152
static bool isEqual(const unsigned long long &LHS, const unsigned long long &RHS)
Definition: DenseMapInfo.h:156
static unsigned short getEmptyKey()
Definition: DenseMapInfo.h:113
static unsigned getHashValue(const unsigned short &Val)
Definition: DenseMapInfo.h:115
static unsigned short getTombstoneKey()
Definition: DenseMapInfo.h:114
static bool isEqual(const unsigned short &LHS, const unsigned short &RHS)
Definition: DenseMapInfo.h:117
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: DenseMapInfo.h:49