Skip to content

Commit af82e63

Browse files
authored
[ADT] DenseMapInfo<unsigned long>::getHashValue - avoid MSVC out of bounds shift warning (#96173)
Fixes MSVC warning after #95734 - despite it taking the `sizeof(Val) == 4` path, it still warns that the 32-bit unsigned long shift by 32 is out of bounds.
1 parent be339fd commit af82e63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/include/llvm/ADT/DenseMapInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ template<> struct DenseMapInfo<unsigned long> {
142142
if constexpr (sizeof(Val) == 4)
143143
return DenseMapInfo<unsigned>::getHashValue(Val);
144144
else
145-
return detail::combineHashValue(Val >> 32, Val);
145+
return densemap::detail::mix(Val);
146146
}
147147

148148
static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) {
@@ -156,7 +156,7 @@ template<> struct DenseMapInfo<unsigned long long> {
156156
static inline unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; }
157157

158158
static unsigned getHashValue(const unsigned long long& Val) {
159-
return detail::combineHashValue(Val >> 32, Val);
159+
return densemap::detail::mix(Val);
160160
}
161161

162162
static bool isEqual(const unsigned long long& LHS,

0 commit comments

Comments
 (0)