KTL
Loading...
Searching...
No Matches
alignment.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
5namespace ktl::detail
6{
7 constexpr size_t ALIGNMENT = alignof(std::max_align_t);
8 constexpr size_t ALIGNMENT_MASK = ALIGNMENT - 1;
9
10 constexpr inline size_t align_to_architecture(size_t n) noexcept
11 {
12 size_t align = n & ALIGNMENT_MASK;
13 if (align != 0)
14 return ALIGNMENT - align;
15
16 return 0;
17 }
18}
Definition fallback_fwd.h:23
constexpr bool has_no_value_type_v
Definition meta.h:17
constexpr size_t ALIGNMENT_MASK
Definition alignment.h:8
constexpr size_t align_to_architecture(size_t n) noexcept
Definition alignment.h:10
constexpr size_t ALIGNMENT
Definition alignment.h:7