2 * Copyright (c) 2022 Philippe Proulx <pproulx@efficios.com>
4 * SPDX-License-Identifier: MIT
7 #ifndef BABELTRACE_CPP_COMMON_STD_INT_HPP
8 #define BABELTRACE_CPP_COMMON_STD_INT_HPP
12 namespace bt2_common {
15 template <std::size_t LenBitsV, bool IsSignedV>
19 struct StdIntTBase<8, true>
21 using Type = std::int8_t;
25 struct StdIntTBase<8, false>
27 using Type = std::uint8_t;
31 struct StdIntTBase<16, true>
33 using Type = std::int16_t;
37 struct StdIntTBase<16, false>
39 using Type = std::uint16_t;
43 struct StdIntTBase<32, true>
45 using Type = std::int32_t;
49 struct StdIntTBase<32, false>
51 using Type = std::uint32_t;
55 struct StdIntTBase<64, true>
57 using Type = std::int64_t;
61 struct StdIntTBase<64, false>
63 using Type = std::uint64_t;
66 } /* namespace internal */
69 * Standard fixed-length integer type `Type` of length `LenBitsV` bits
70 * and signedness `IsSignedV`.
72 * `LenBitsV` must be one of 8, 16, 32, or 64.
74 * For example, `StdIntT<32, true>` is `std::int32_t`.
76 template <std::size_t LenBitsV, bool IsSignedV>
77 using StdIntT = typename internal::StdIntTBase<LenBitsV, IsSignedV>::Type;
79 } /* namespace bt2_common */
81 #endif /* BABELTRACE_CPP_COMMON_STD_INT_HPP */