Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jul 19, 2019
1 parent e9b9b0a commit 6a497e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/fmt/safe-duration-cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,15 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
// multiply with Factor::num without overflow or underflow
if (Factor::num != 1) {
constexpr auto max1 =
std::numeric_limits<IntermediateRep>::max() / Factor::num;
std::numeric_limits<IntermediateRep>::max() /
static_cast<IntermediateRep>(Factor::num);
if (count > max1) {
ec = 1;
return {};
}
constexpr auto min1 =
std::numeric_limits<IntermediateRep>::lowest() / Factor::num;
std::numeric_limits<IntermediateRep>::lowest() /
static_cast<IntermediateRep>(Factor::num);
if (count < min1) {
ec = 1;
return {};
Expand Down

0 comments on commit 6a497e1

Please sign in to comment.