Clear truncation warning in rng.cpp (PR #867)

pull/870/head
Jeffrey Walton 2019-07-25 04:52:24 -04:00
parent 12382a14be
commit e4c402ace9
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 5 additions and 6 deletions

11
rng.cpp
View File

@ -40,15 +40,14 @@ void LC_RNG::GenerateBlock(byte *output, size_t size)
{ {
while (size--) while (size--)
{ {
word32 hi = seed/q; const word32 hi = seed/q;
word32 lo = seed%q; const word32 lo = seed%q;
const sword64 test = a*lo - r*hi;
sword64 test = a*lo - r*hi;
if (test > 0) if (test > 0)
seed = test; seed = static_cast<word32>(test);
else else
seed = test+ m; seed = static_cast<word32>(test + m);
*output++ = byte((GETBYTE(seed, 0) ^ GETBYTE(seed, 1) ^ GETBYTE(seed, 2) ^ GETBYTE(seed, 3))); *output++ = byte((GETBYTE(seed, 0) ^ GETBYTE(seed, 1) ^ GETBYTE(seed, 2) ^ GETBYTE(seed, 3)));
} }