tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches

High-level memory management utilities. More...

Functions

template<etl::size_t N, typename T>
constexpr auto assume_aligned (T *ptr) -> T *
 Informs the implementation that the object ptr points to is aligned to at least N. The implementation may use this information to generate more efficient code, but it might only make this assumption if the object is accessed via the return value of assume_aligned.
 

Detailed Description

High-level memory management utilities.

Function Documentation

◆ assume_aligned()

template<etl::size_t N, typename T>
auto assume_aligned ( T * ptr) -> T*
nodiscardconstexpr

Informs the implementation that the object ptr points to is aligned to at least N. The implementation may use this information to generate more efficient code, but it might only make this assumption if the object is accessed via the return value of assume_aligned.

The program is ill-formed if N is not a power of 2. The behavior is undefined if ptr does not point to an object of type T (ignoring cv-qualification at every level), or if the object's alignment is not at least N.

https://en.cppreference.com/w/cpp/memory/assume_aligned