From e4c402ace907100cc1e71dabda7055034efaf06e Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 25 Jul 2019 04:52:24 -0400 Subject: [PATCH] Clear truncation warning in rng.cpp (PR #867) --- rng.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/rng.cpp b/rng.cpp index 5056019f..1bb525e9 100644 --- a/rng.cpp +++ b/rng.cpp @@ -40,15 +40,14 @@ void LC_RNG::GenerateBlock(byte *output, size_t size) { while (size--) { - word32 hi = seed/q; - word32 lo = seed%q; - - sword64 test = a*lo - r*hi; + const word32 hi = seed/q; + const word32 lo = seed%q; + const sword64 test = a*lo - r*hi; if (test > 0) - seed = test; + seed = static_cast(test); else - seed = test+ m; + seed = static_cast(test + m); *output++ = byte((GETBYTE(seed, 0) ^ GETBYTE(seed, 1) ^ GETBYTE(seed, 2) ^ GETBYTE(seed, 3))); }