diff options
author | Martin Ankerl <martin.ankerl@gmail.com> | 2021-09-18 14:12:43 +0200 |
---|---|---|
committer | Martin Ankerl <martin.ankerl@gmail.com> | 2021-09-21 14:45:49 +0200 |
commit | e148a5233292d156cda76cb20afb6641fc20f25e (patch) | |
tree | a51d7fe8c61d86c1254d443e78b5dc31fd4d2d88 /src/bench/crypto_hash.cpp | |
parent | da4e2f1da0388d424659fa8c853fcaf37b4b5959 (diff) | |
download | bitcoin-e148a5233292d156cda76cb20afb6641fc20f25e.tar.xz |
bench: fixed ubsan implicit conversion
The benchmarks can now run much longer due to the minimum of 10ms or
directly with -min_time. With -min_time=20000 I could trigger two ubsan
errors in the benchmarks, which are fixed in this commit by using
unsigned type and adding "& 0xFF".
Diffstat (limited to 'src/bench/crypto_hash.cpp')
-rw-r--r-- | src/bench/crypto_hash.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bench/crypto_hash.cpp b/src/bench/crypto_hash.cpp index 7d5e3ca4ee..d36e504bfc 100644 --- a/src/bench/crypto_hash.cpp +++ b/src/bench/crypto_hash.cpp @@ -110,9 +110,9 @@ static void MuHash(benchmark::Bench& bench) { MuHash3072 acc; unsigned char key[32] = {0}; - int i = 0; + uint32_t i = 0; bench.run([&] { - key[0] = ++i; + key[0] = ++i & 0xFF; acc *= MuHash3072(key); }); } |