We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7ef199 commit c63bbccCopy full SHA for c63bbcc
llvm/include/llvm/Support/MathExtras.h
@@ -196,16 +196,8 @@ constexpr bool isShiftedInt(int64_t x) {
196
197
/// Checks if an unsigned integer fits into the given bit width.
198
template <unsigned N> constexpr bool isUInt(uint64_t x) {
199
- if constexpr (N == 0)
200
- return 0 == x;
201
- if constexpr (N == 8)
202
- return static_cast<uint8_t>(x) == x;
203
- if constexpr (N == 16)
204
- return static_cast<uint16_t>(x) == x;
205
- if constexpr (N == 32)
206
- return static_cast<uint32_t>(x) == x;
207
if constexpr (N < 64)
208
- return x < (UINT64_C(1) << (N));
+ return (x >> N) == 0;
209
(void)x; // MSVC v19.25 warns that x is unused.
210
return true;
211
}
0 commit comments