Use std::numeric_limits<> for typesafe INT_MAX/etc

This commit is contained in:
Gavin Andresen
2011-12-19 17:08:25 -05:00
parent bd846c0e56
commit 26ce92b352
13 changed files with 26 additions and 34 deletions

View File

@@ -115,9 +115,9 @@ public:
{
unsigned long n = BN_get_word(this);
if (!BN_is_negative(this))
return (n > INT_MAX ? INT_MAX : n);
return (n > std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : n);
else
return (n > INT_MAX ? INT_MIN : -(int)n);
return (n > std::numeric_limits<int>::max() ? std::numeric_limits<int>::min() : -(int)n);
}
void setint64(int64 n)