Fix warnings (#1288)

This commit is contained in:
Victor Zverovich 2019-08-31 07:10:33 -07:00
parent c76957565c
commit 9a56a608ee

View File

@ -62,7 +62,7 @@ FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) {
if (F::is_signed && !T::is_signed) { if (F::is_signed && !T::is_signed) {
// From may be negative, not allowed! // From may be negative, not allowed!
if (from < 0) { if (fmt::internal::is_negative(from)) {
ec = 1; ec = 1;
return {}; return {};
} }
@ -182,14 +182,12 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
} }
// multiply with Factor::num without overflow or underflow // multiply with Factor::num without overflow or underflow
if (Factor::num != 1) { if (Factor::num != 1) {
constexpr auto max1 = const auto max1 = std::numeric_limits<IntermediateRep>::max() / Factor::num;
std::numeric_limits<IntermediateRep>::max() / Factor::num;
if (count > max1) { if (count > max1) {
ec = 1; ec = 1;
return {}; return {};
} }
constexpr auto min1 = const auto min1 = std::numeric_limits<IntermediateRep>::min() / Factor::num;
std::numeric_limits<IntermediateRep>::min() / Factor::num;
if (count < min1) { if (count < min1) {
ec = 1; ec = 1;
return {}; return {};