30#ifndef _GLIBCXX_ALIGN_H
31#define _GLIBCXX_ALIGN_H 1
39namespace std _GLIBCXX_VISIBILITY(default)
41_GLIBCXX_BEGIN_NAMESPACE_VERSION
62align(
size_t __align,
size_t __size,
void*& __ptr,
size_t& __space)
noexcept
66 const auto __intptr =
reinterpret_cast<uintptr_t
>(__ptr);
67 const auto __aligned = (__intptr - 1u + __align) & -__align;
68 const auto __diff = __aligned - __intptr;
69 if (__diff > (__space - __size))
74 return __ptr =
reinterpret_cast<void*
>(__aligned);
78#if __cplusplus > 201703L
79#define __cpp_lib_assume_aligned 201811L
90 template<
size_t _Align,
class _Tp>
91 [[nodiscard,__gnu__::__always_inline__]]
102 _GLIBCXX_DEBUG_ASSERT((uintptr_t)__ptr % _Align == 0);
103 return static_cast<_Tp*
>(__builtin_assume_aligned(__ptr, _Align));
108_GLIBCXX_END_NAMESPACE_VERSION
constexpr _If_is_unsigned_integer< _Tp, bool > has_single_bit(_Tp __x) noexcept
True if x is a power of two, false otherwise.
constexpr _Tp * assume_aligned(_Tp *__ptr) noexcept
Inform the compiler that a pointer is aligned.
void * align(size_t __align, size_t __size, void *&__ptr, size_t &__space) noexcept
Fit aligned storage in buffer.
constexpr bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
ISO C++ entities toplevel namespace is std.