cpp-common/bt2c: add `format_as()` functions for `Uuid` and `UuidView`
[babeltrace.git] / src / cpp-common / bt2c / align.hpp
CommitLineData
f38a365f
PP
1/*
2 * Copyright (c) 2022 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
094bf3f2
SM
7#ifndef BABELTRACE_CPP_COMMON_BT2C_ALIGN_HPP
8#define BABELTRACE_CPP_COMMON_BT2C_ALIGN_HPP
f38a365f
PP
9
10#include <type_traits>
11
12#include "common/align.h"
13
094bf3f2 14namespace bt2c {
f38a365f
PP
15
16template <typename ValT, typename AlignT>
17ValT align(const ValT val, const AlignT align) noexcept
18{
19 static_assert(std::is_unsigned<ValT>::value, "`ValT` is unsigned.");
20 return BT_ALIGN(val, static_cast<ValT>(align));
21}
22
094bf3f2 23} /* namespace bt2c */
f38a365f 24
094bf3f2 25#endif /* BABELTRACE_CPP_COMMON_BT2C_ALIGN_HPP */
This page took 0.03262 seconds and 4 git commands to generate.