diff options
author | Jack Lloyd <[email protected]> | 2017-08-29 11:16:57 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-08-29 11:16:57 -0400 |
commit | e8e5983e292f28b0de3595a17fb89e999934e413 (patch) | |
tree | 1c930e9177297c179a1a31a7eb793194624a8861 /src/lib | |
parent | 433beecf569b8066779e2a69c95eac8de4c6868a (diff) |
Avoid math on booleans
Sonar find
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/hash/streebog/streebog.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/hash/streebog/streebog.cpp b/src/lib/hash/streebog/streebog.cpp index 9007b2133..c58320bca 100644 --- a/src/lib/hash/streebog/streebog.cpp +++ b/src/lib/hash/streebog/streebog.cpp @@ -22,14 +22,14 @@ namespace { static inline void addm(const uint8_t* m, uint64_t* h) { - bool carry = false; + uint64_t carry = false; for(int i = 0; i < 8; i++) { const uint64_t m64 = load_le<uint64_t>(m, i); const uint64_t hi = load_le<uint64_t>(reinterpret_cast<uint8_t*>(h), i); - uint64_t t = hi + m64; + const uint64_t t = hi + m64; - const bool overflow = t < hi || t < m64; + const uint64_t overflow = (t < hi) | (t < m64); store_le(t + carry, reinterpret_cast<uint8_t*>(&h[i])); carry = overflow; } |