Changeset View
Changeset View
Standalone View
Standalone View
src/radix.h
Show First 20 Lines • Show All 341 Lines • ▼ Show 20 Lines | public: | ||||
e.incrementRefCount(); | e.incrementRefCount(); | ||||
non_atomic_children_DO_NOT_USE[i] = e; | non_atomic_children_DO_NOT_USE[i] = e; | ||||
} | } | ||||
} | } | ||||
RadixNode &operator=(const RadixNode &) = delete; | RadixNode &operator=(const RadixNode &) = delete; | ||||
std::atomic<RadixElement> *get(uint32_t level, const K &key) { | std::atomic<RadixElement> *get(uint32_t level, const K &key) { | ||||
return &children[(key >> (level * BITS)) & MASK]; | return &children[T::IndexFromKey(key, level * BITS, MASK)]; | ||||
} | } | ||||
bool isShared() const { return refcount > 0; } | bool isShared() const { return refcount > 0; } | ||||
}; | }; | ||||
// Make sure the alignment works for T and RadixElement. | // Make sure the alignment works for T and RadixElement. | ||||
static_assert(alignof(T) > 1, "T's alignment must be 2 or more."); | static_assert(alignof(T) > 1, "T's alignment must be 2 or more."); | ||||
static_assert(alignof(RadixNode) > 1, | static_assert(alignof(RadixNode) > 1, | ||||
"RadixNode alignment must be 2 or more."); | "RadixNode alignment must be 2 or more."); | ||||
}; | }; | ||||
#endif // BITCOIN_RADIX_H | #endif // BITCOIN_RADIX_H |