Alignment

These APIs aid in aligning pointers and types. They are typically available for both C and C++.

ZTD_ASSUME_ALIGNED(_ALIGNMENT, ...)

Returns a pointer suitable-aligned for _ALIGNMENT.

Remark

This function does NOT align the pointer, just marks it as such. This uses builtins or other tricks depending on the compiler. It can trigger Undefined Behavior if it is not properly checked and protected against, so make sure the pointer is properly aligned.

Parameters
  • _ALIGNMENT[in] An integer constant expression indicating the alignment of the pointer value.

  • ...[in] The pointer to assume alignment of.

Returns

A pointer (assumed to be) suitably-aligned to _ALIGNMENT.