summaryrefslogtreecommitdiff
path: root/rng.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-07-25 04:52:24 -0400
committerJeffrey Walton <noloader@gmail.com>2019-07-25 04:52:24 -0400
commite4c402ace907100cc1e71dabda7055034efaf06e (patch)
treec10bc9ac1dffbf1302822e54fadebea4d18f7fac /rng.cpp
parent12382a14bef384f12b739d096beb556ba04bd199 (diff)
downloadcryptopp-git-e4c402ace907100cc1e71dabda7055034efaf06e.tar.gz
Clear truncation warning in rng.cpp (PR #867)
Diffstat (limited to 'rng.cpp')
-rw-r--r--rng.cpp11
1 files 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<word32>(test);
else
- seed = test+ m;
+ seed = static_cast<word32>(test + m);
*output++ = byte((GETBYTE(seed, 0) ^ GETBYTE(seed, 1) ^ GETBYTE(seed, 2) ^ GETBYTE(seed, 3)));
}