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