mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-03 06:41:03 +00:00
Pointless comparison warnings (#2971)
Co-authored-by: Federico Busato <fbusato@nvidia.com>
This commit is contained in:
parent
05be7a0764
commit
0db43cf7fe
@ -203,7 +203,7 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
|
||||
}
|
||||
const auto min1 =
|
||||
(std::numeric_limits<IntermediateRep>::min)() / Factor::num;
|
||||
if (count < min1) {
|
||||
if (!std::is_unsigned<IntermediateRep>::value && count < min1) {
|
||||
ec = 1;
|
||||
return {};
|
||||
}
|
||||
@ -1396,7 +1396,8 @@ inline bool isfinite(T) {
|
||||
// Converts value to Int and checks that it's in the range [0, upper).
|
||||
template <typename T, typename Int, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
inline Int to_nonnegative_int(T value, Int upper) {
|
||||
FMT_ASSERT(value >= 0 && to_unsigned(value) <= to_unsigned(upper),
|
||||
FMT_ASSERT(std::is_unsigned<Int>::value ||
|
||||
(value >= 0 && to_unsigned(value) <= to_unsigned(upper)),
|
||||
"invalid value");
|
||||
(void)upper;
|
||||
return static_cast<Int>(value);
|
||||
|
@ -405,7 +405,7 @@ template <typename T> auto convert_for_visit(T) -> monostate { return {}; }
|
||||
template <typename Int>
|
||||
FMT_CONSTEXPR auto to_unsigned(Int value) ->
|
||||
typename std::make_unsigned<Int>::type {
|
||||
FMT_ASSERT(value >= 0, "negative value");
|
||||
FMT_ASSERT(std::is_unsigned<Int>::value || value >= 0, "negative value");
|
||||
return static_cast<typename std::make_unsigned<Int>::type>(value);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user