cptr::default_cage::compress

The cage is aligned to its own size, so a pointer's offset is its low SizeLog2 bits: compressing is a mask and a shift, and nullptr maps to 0 with no branch. A pointer from outside the cage is caught only by CPTR_CHECK. In a constant expression only nullptr can be compressed.

Synopsis

Declared in <cptr/cage.hpp>

constexpr
static
uint32_t
compress(void const* p) noexcept;