76#define PTRTAG __attribute__((aligned(4)))
89static inline void *
ptrtag(
void *ptr, uint8_t tag)
91 uintptr_t tmp = (uintptr_t)ptr;
93 assert((tag < 4) && !(tmp & 0x3));
94 return (
void *)(tmp | tag);
104 uintptr_t tagged = (uintptr_t)tagged_ptr;
105 const uintptr_t mask = 0x3;
106 return (
void *)(tagged & (~mask));
116 uintptr_t tagged = (uintptr_t)tagged_ptr;
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
static uint8_t ptrtag_tag(void *tagged_ptr)
Extract the tag from a tagged pointer.
static void * ptrtag_ptr(void *tagged_ptr)
Extract the original pointer from a tagged pointer.
static void * ptrtag(void *ptr, uint8_t tag)
Create a tagged pointer.
Adds include for missing inttype definitions.