Skip to content

Commit a01933d

Browse files
authored
[ADT] Fix signed integer overflow (#155826)
Fixes the signed overflow for signed types > int after #155549
1 parent 890bc46 commit a01933d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/include/llvm/ADT/DenseMapInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ struct DenseMapInfo<
124124
if constexpr (std::is_unsigned_v<T> && sizeof(T) > sizeof(unsigned))
125125
return densemap::detail::mix(Val);
126126
else
127-
return static_cast<unsigned>(Val * 37U);
127+
return static_cast<unsigned>(Val *
128+
static_cast<std::make_unsigned_t<T>>(37U));
128129
}
129130

130131
static bool isEqual(const T &LHS, const T &RHS) { return LHS == RHS; }

0 commit comments

Comments
 (0)