mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
refactor: move flags to private uint8_t and rename to m_flags
No behavior change. This prepares to add CCoinsCacheEntrys to a doubly linked list when a flag is added.
This commit is contained in:
parent
4e4fb4cbab
commit
f08faeade2
2 changed files with 10 additions and 7 deletions
15
src/coins.h
15
src/coins.h
|
@ -103,8 +103,11 @@ public:
|
|||
*/
|
||||
struct CCoinsCacheEntry
|
||||
{
|
||||
private:
|
||||
uint8_t m_flags{0};
|
||||
|
||||
public:
|
||||
Coin coin; // The actual cached data.
|
||||
unsigned char flags{0};
|
||||
|
||||
enum Flags {
|
||||
/**
|
||||
|
@ -130,14 +133,14 @@ struct CCoinsCacheEntry
|
|||
CCoinsCacheEntry() noexcept = default;
|
||||
explicit CCoinsCacheEntry(Coin&& coin_) noexcept : coin(std::move(coin_)) {}
|
||||
|
||||
inline void AddFlags(unsigned char flags) noexcept { this->flags |= flags; }
|
||||
inline void AddFlags(uint8_t flags) noexcept { m_flags |= flags; }
|
||||
inline void ClearFlags() noexcept
|
||||
{
|
||||
flags = 0;
|
||||
m_flags = 0;
|
||||
}
|
||||
inline unsigned char GetFlags() const noexcept { return flags; }
|
||||
inline bool IsDirty() const noexcept { return flags & DIRTY; }
|
||||
inline bool IsFresh() const noexcept { return flags & FRESH; }
|
||||
inline uint8_t GetFlags() const noexcept { return m_flags; }
|
||||
inline bool IsDirty() const noexcept { return m_flags & DIRTY; }
|
||||
inline bool IsFresh() const noexcept { return m_flags & FRESH; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,7 +125,7 @@ FUZZ_TARGET(coins_view, .init = initialize_coins_view)
|
|||
LIMITED_WHILE(good_data && fuzzed_data_provider.ConsumeBool(), 10'000)
|
||||
{
|
||||
CCoinsCacheEntry coins_cache_entry;
|
||||
coins_cache_entry.AddFlags(fuzzed_data_provider.ConsumeIntegral<unsigned char>());
|
||||
coins_cache_entry.AddFlags(fuzzed_data_provider.ConsumeIntegral<uint8_t>());
|
||||
if (fuzzed_data_provider.ConsumeBool()) {
|
||||
coins_cache_entry.coin = random_coin;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue