2 * Copyright (c) 2022 Philippe Proulx <pproulx@efficios.com>
4 * SPDX-License-Identifier: MIT
7 #ifndef BABELTRACE_CPP_COMMON_ALIGN_HPP
8 #define BABELTRACE_CPP_COMMON_ALIGN_HPP
10 #include <type_traits>
12 #include "common/align.h"
14 namespace bt2_common {
16 template <typename ValT, typename AlignT>
17 ValT align(const ValT val, const AlignT align) noexcept
19 static_assert(std::is_unsigned<ValT>::value, "`ValT` is unsigned.");
20 return BT_ALIGN(val, static_cast<ValT>(align));
23 } /* namespace bt2_common */
25 #endif /* BABELTRACE_CPP_COMMON_ALIGN_HPP */