Skip to content

Commit c213d8c

Browse files
committed
[ADT] DenseMapInfo<unsigned long>::getHashValue - avoid MSVC out of bounds shift warning
Fixes MSVC warning after llvm#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, so avoid it by converting the hard coded shift amount to be based off sizeof() instead.
1 parent 90779fd commit c213d8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/include/llvm/ADT/DenseMapInfo.h

Lines changed: 1 addition & 1 deletion
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 detail::combineHashValue(Val >> (4 * sizeof(Val)), Val);
146146
}
147147

148148
static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) {

0 commit comments

Comments
 (0)