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

(this fixes a Mac OS X gitian build error for 0.5.x)
This commit is contained in:
Gavin Andresen
2011-12-19 17:08:25 -05:00
committed by Luke Dashjr
parent ca39829ecb
commit 5cd2a640a5
11 changed files with 24 additions and 32 deletions

View File

@@ -144,7 +144,7 @@ uint64 GetRand(uint64 nMax)
// The range of the random source must be a multiple of the modulus
// to give every possible output value an equal possibility
uint64 nRange = (UINT64_MAX / nMax) * nMax;
uint64 nRange = (std::numeric_limits<uint64>::max() / nMax) * nMax;
uint64 nRand = 0;
do
RAND_bytes((unsigned char*)&nRand, sizeof(nRand));