Changeset View
Changeset View
Standalone View
Standalone View
src/cuckoocache.h
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | public: | ||||
* | * | ||||
* @param size the number of elements to allocate space for | * @param size the number of elements to allocate space for | ||||
* | * | ||||
* @post bit_set, bit_unset, and bit_is_set function properly forall x. x < | * @post bit_set, bit_unset, and bit_is_set function properly forall x. x < | ||||
* size | * size | ||||
* @post All calls to bit_is_set (without subsequent bit_unset) will return | * @post All calls to bit_is_set (without subsequent bit_unset) will return | ||||
* true. | * true. | ||||
*/ | */ | ||||
bit_packed_atomic_flags(uint32_t size) { | explicit bit_packed_atomic_flags(uint32_t size) { | ||||
// pad out the size if needed | // pad out the size if needed | ||||
size = (size + 7) / 8; | size = (size + 7) / 8; | ||||
mem.reset(new std::atomic<uint8_t>[size]); | mem.reset(new std::atomic<uint8_t>[size]); | ||||
for (uint32_t i = 0; i < size; ++i) | for (uint32_t i = 0; i < size; ++i) | ||||
mem[i].store(0xFF); | mem[i].store(0xFF); | ||||
}; | }; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 395 Lines • Show Last 20 Lines |