Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/include/llvm/Support/MathExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ inline constexpr int64_t minIntN(int64_t N) {

if (N == 0)
return 0;
return UINT64_C(1) + ~(UINT64_C(1) << (N - 1));
return UINT64_MAX << (N - 1);
}

/// Gets the maximum value for a N-bit signed integer.
Expand All @@ -241,7 +241,7 @@ inline constexpr int64_t maxIntN(int64_t N) {

/// Checks if an unsigned integer fits into the given (dynamic) bit width.
inline constexpr bool isUIntN(unsigned N, uint64_t x) {
return N >= 64 || x <= maxUIntN(N);
return N >= 64 || (x >> N) == 0;
}

/// Checks if an signed integer fits into the given (dynamic) bit width.
Expand Down