Skip to content

Commit

Permalink
fix clang warning 'implicit-int-float-conversion'
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyG committed Jan 7, 2020
1 parent 9e937ff commit 9cd51b3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rttr/detail/conversion/number_conversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ typename std::enable_if<std::is_floating_point<F>::value &&
bool>::type
convert_to(const F& from, T& to)
{
if (from > std::numeric_limits<T>::max())
if (from > static_cast<F>(std::numeric_limits<T>::max()))
return false; // value too large
else if (from < -std::numeric_limits<T>::max())
else if (from < static_cast<F>(-std::numeric_limits<T>::max()))
return false; // value to small

to = static_cast<T>(from);
Expand All @@ -151,7 +151,7 @@ typename std::enable_if<std::is_floating_point<F>::value &&
bool>::type
convert_to(const F& from, T& to)
{
if (from < 0 || from > std::numeric_limits<T>::max())
if (from < 0 || from > static_cast<F>(std::numeric_limits<T>::max()))
return false; // value too large

to = static_cast<T>(from);
Expand Down

0 comments on commit 9cd51b3

Please sign in to comment.