Skip to content

Commit

Permalink
Fix macro and member function confilct for min and max (GH #1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
irwir authored Jun 23, 2023
1 parent 0cf0845 commit a5f4738
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ inline bool SafeConvert(sword32 from, word64 &to)
template<>
inline bool SafeConvert(word64 from, sword64 &to)
{
if (from > static_cast<word64>(std::numeric_limits<sword64>::max()))
if (from > static_cast<word64>((std::numeric_limits<sword64>::max)()))
return false;
to = static_cast<sword64>(from);
return true;
Expand Down Expand Up @@ -827,7 +827,7 @@ inline bool SafeConvert(sword32 from, sword64 &to)
template<>
inline bool SafeConvert(word64 from, word32 &to)
{
if (from > static_cast<word64>(std::numeric_limits<word32>::max()))
if (from > static_cast<word64>((std::numeric_limits<word32>::max)()))
return false;
to = static_cast<word32>(from);
return true;
Expand All @@ -845,7 +845,7 @@ inline bool SafeConvert(sword64 from, word32 &to)
{
if (from < 0)
return false;
else if (from > static_cast<sword64>(std::numeric_limits<word32>::max()))
else if (from > static_cast<sword64>((std::numeric_limits<word32>::max)()))
return false;
to = static_cast<word32>(from);
return true;
Expand Down Expand Up @@ -877,7 +877,7 @@ inline bool SafeConvert(sword32 from, word32 &to)
template<>
inline bool SafeConvert(word64 from, sword32 &to)
{
if (from > static_cast<word64>(std::numeric_limits<sword32>::max()))
if (from > static_cast<word64>((std::numeric_limits<sword32>::max)()))
return false;
to = static_cast<sword32>(from);
return true;
Expand All @@ -893,9 +893,9 @@ inline bool SafeConvert(word64 from, sword32 &to)
template<>
inline bool SafeConvert(sword64 from, sword32 &to)
{
if (from > static_cast<sword64>(std::numeric_limits<sword32>::max()))
if (from > static_cast<sword64>((std::numeric_limits<sword32>::max)()))
return false;
else if (from < static_cast<sword64>(std::numeric_limits<sword32>::min()))
else if (from < static_cast<sword64>((std::numeric_limits<sword32>::min)()))
return false;
to = static_cast<sword32>(from);
return true;
Expand All @@ -911,7 +911,7 @@ inline bool SafeConvert(sword64 from, sword32 &to)
template<>
inline bool SafeConvert(word32 from, sword32 &to)
{
if (from > static_cast<word32>(std::numeric_limits<sword32>::max()))
if (from > static_cast<word32>((std::numeric_limits<sword32>::max)()))
return false;
to = static_cast<sword32>(from);
return true;
Expand Down

0 comments on commit a5f4738

Please sign in to comment.