Skip to content

Commit fa7da22

Browse files
author
MarcoFalke
committed
refactor: Fix implicit-signed-integer-truncation in cuckoocache.h
1 parent b4f647f commit fa7da22

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/cuckoocache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class bit_packed_atomic_flags
8989
*/
9090
inline void bit_set(uint32_t s)
9191
{
92-
mem[s >> 3].fetch_or(1 << (s & 7), std::memory_order_relaxed);
92+
mem[s >> 3].fetch_or(uint8_t(1 << (s & 7)), std::memory_order_relaxed);
9393
}
9494

9595
/** bit_unset marks an entry as something that should not be overwritten.
@@ -100,7 +100,7 @@ class bit_packed_atomic_flags
100100
*/
101101
inline void bit_unset(uint32_t s)
102102
{
103-
mem[s >> 3].fetch_and(~(1 << (s & 7)), std::memory_order_relaxed);
103+
mem[s >> 3].fetch_and(uint8_t(~(1 << (s & 7))), std::memory_order_relaxed);
104104
}
105105

106106
/** bit_is_set queries the table for discardability at `s`.

test/sanitizer_suppressions/ubsan

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ implicit-signed-integer-truncation:addrman.cpp
8686
implicit-signed-integer-truncation:addrman.h
8787
implicit-signed-integer-truncation:chain.h
8888
implicit-signed-integer-truncation:crypto/
89-
implicit-signed-integer-truncation:cuckoocache.h
9089
implicit-signed-integer-truncation:leveldb/
9190
implicit-signed-integer-truncation:node/miner.cpp
9291
implicit-signed-integer-truncation:net.cpp

0 commit comments

Comments
 (0)