13enum class WorkType : uint8_t {
20inline std::pair<void *, WorkType> decode_work(
void *ptr) {
21 intptr_t mask = (1 << 3) - 1;
22 intptr_t addr =
reinterpret_cast<intptr_t
>(ptr);
23 WorkType type =
static_cast<WorkType
>(addr & mask);
25 void *actual_ptr =
reinterpret_cast<void *
>(addr & (~mask));
26 return std::make_pair(actual_ptr, type);
29inline void *encode_work(
void *ptr, WorkType type) {
30 intptr_t addr =
reinterpret_cast<intptr_t
>(ptr);
32 assert(addr % 8 == 0);
33 addr |=
static_cast<intptr_t
>(type);
35 return reinterpret_cast<void *
>(addr);
The main namespace for the Condy library.