pub unsafe fn pack<T: Sized>(ptr: *mut T, a: u8, s: bool, v: u8) -> *mut T
Expand description
Packs a pointer into the bottom sizeof(usize) - (a + s + v)
bits of a usize.
Safety
- T’s alignment must enable stealing A bits.
- The high bits (sign upwards) must match a stack pointer’s high bits.
- If compiling for a 64bit arch, V must be at most 25.
- If compiling for a non-64bit arch, V must be 0.
These invariants are checked with debug_assert
only, hence
unsafe
. The usual caveats of pointers apply.