5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UTILITY_ALIGNMENT_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UTILITY_ALIGNMENT_HPP_
26#include "arene/base/constraints/constraints.hpp"
27#include "arene/base/contracts/contract.hpp"
28#include "arene/base/math/power_of_2.hpp"
29#include "arene/base/stdlib_choice/climits.hpp"
30#include "arene/base/stdlib_choice/cstddef.hpp"
31#include "arene/base/stdlib_choice/cstdint.hpp"
32#include "arene/base/stdlib_choice/enable_if.hpp"
33#include "arene/base/stdlib_choice/is_integral.hpp"
34#include "arene/base/stdlib_choice/is_unsigned.hpp"
35#include "arene/base/stdlib_choice/make_unsigned.hpp"
36#include "arene/base/stdlib_choice/numeric_limits.hpp"
44namespace alignment_detail {
47using pointer_to_anything =
void const volatile*;
66 "Attempting to align to a value that is larger than the "
67 "maximum representable value."
79template <std::size_t Alignment>
82constexpr auto is_aligned(alignment_detail::pointer_to_anything
const pointer) ->
bool {
85 return is_aligned<Alignment>(
reinterpret_cast<std::uintptr_t>(pointer));
104 "Attempting to align to a value that is larger than the "
105 "maximum representable value."
127 "Attempting to align to a value that is larger than the "
128 "maximum representable value."
141template <std::size_t Alignment>
147 std::uintptr_t
const base{
reinterpret_cast<std::uintptr_t>(ptr)};
149 std::size_t
const offset{::arene::base::align_ceil<Alignment>(base) - base};
Definition array_exceptions_disabled.cpp:11
auto alignment_offset(alignment_detail::pointer_to_anything const ptr) noexcept -> std::size_t
Calculate the amount by which ptr needs to be adjusted to have the specified Alignment.
Definition alignment.hpp:143
constexpr auto is_aligned(alignment_detail::pointer_to_anything const pointer) -> bool
Check if an address is a multiple of the specified alignment.
Definition alignment.hpp:82
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10