77#define PTRTAG __attribute__((aligned(4)))
90static inline void *
ptrtag(
void *ptr, uint8_t tag)
92 uintptr_t tmp = (uintptr_t)ptr;
94 assert((tag < 4) && !(tmp & 0x3));
95 return (
void *)(tmp | tag);
105 uintptr_t tagged = (uintptr_t)tagged_ptr;
106 const uintptr_t mask = 0x3;
107 return (
void *)(tagged & (~mask));
117 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.