4#ifndef TETL_MEMORY_ASSUME_ALIGNED_HPP
5#define TETL_MEMORY_ASSUME_ALIGNED_HPP
7#include <etl/_config/all.hpp>
9#include <etl/_bit/has_single_bit.hpp>
10#include <etl/_cstddef/size_t.hpp>
11#include <etl/_type_traits/is_constant_evaluated.hpp>
28template <
etl::size_t N,
typename T>
32 static_assert(
alignof(T) <= N);
35#if __has_builtin(__builtin_assume_aligned)
36 return static_cast<T*>(__builtin_assume_aligned(ptr, N));
constexpr auto has_single_bit(UInt x) noexcept -> bool
Checks if x is an integral power of two.
Definition has_single_bit.hpp:22
constexpr auto assume_aligned(T *ptr) -> T *
Informs the implementation that the object ptr points to is aligned to at least N....
Definition assume_aligned.hpp:29
Definition adjacent_find.hpp:9
constexpr auto is_constant_evaluated() noexcept -> bool
Detects whether the function call occurs within a constant-evaluated context. Returns true if the eva...
Definition is_constant_evaluated.hpp:17