diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-11-29 14:33:48 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-11-29 14:32:51 +0100 |
commit | fa7da227daf8558be14f226c4366583fdc59ba10 (patch) | |
tree | 8eb9cc498f261c58c2947c66f908be3e9be852f9 | |
parent | b4f647fa36a3336774ab616048bc6709bdc59fa1 (diff) | |
download | bitcoin-fa7da227daf8558be14f226c4366583fdc59ba10.tar.xz |
refactor: Fix implicit-signed-integer-truncation in cuckoocache.h
-rw-r--r-- | src/cuckoocache.h | 4 | ||||
-rw-r--r-- | test/sanitizer_suppressions/ubsan | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/cuckoocache.h b/src/cuckoocache.h index 1166466771..15cb55c3ce 100644 --- a/src/cuckoocache.h +++ b/src/cuckoocache.h @@ -89,7 +89,7 @@ public: */ inline void bit_set(uint32_t s) { - mem[s >> 3].fetch_or(1 << (s & 7), std::memory_order_relaxed); + mem[s >> 3].fetch_or(uint8_t(1 << (s & 7)), std::memory_order_relaxed); } /** bit_unset marks an entry as something that should not be overwritten. @@ -100,7 +100,7 @@ public: */ inline void bit_unset(uint32_t s) { - mem[s >> 3].fetch_and(~(1 << (s & 7)), std::memory_order_relaxed); + mem[s >> 3].fetch_and(uint8_t(~(1 << (s & 7))), std::memory_order_relaxed); } /** bit_is_set queries the table for discardability at `s`. diff --git a/test/sanitizer_suppressions/ubsan b/test/sanitizer_suppressions/ubsan index 6032fe496f..bb7a1a5f45 100644 --- a/test/sanitizer_suppressions/ubsan +++ b/test/sanitizer_suppressions/ubsan @@ -86,7 +86,6 @@ implicit-signed-integer-truncation:addrman.cpp implicit-signed-integer-truncation:addrman.h implicit-signed-integer-truncation:chain.h implicit-signed-integer-truncation:crypto/ -implicit-signed-integer-truncation:cuckoocache.h implicit-signed-integer-truncation:leveldb/ implicit-signed-integer-truncation:node/miner.cpp implicit-signed-integer-truncation:net.cpp |