Function CE::Memory::Pointers::align_offset

Function Documentation

inline std::size_t CE::Memory::Pointers::align_offset(void *ptr, std::size_t offset_bytes, std::align_val_t alignment)

Rounds a forward byte offset up so the resulting address is aligned.

Parameters:
  • ptr – Borrowed storage base.

  • offset_bytes – Initial forward byte displacement.

  • alignment – Nonzero valid alignment of the final address.

Returns:

Initial displacement plus required padding, in bytes.

Pre:

Both additions are representable and stay within the backing allocation.