1#ifndef BOOST_ENDIAN_DETAIL_INTEGRAL_BY_SIZE_HPP_INCLUDED
2#define BOOST_ENDIAN_DETAIL_INTEGRAL_BY_SIZE_HPP_INCLUDED
3
4// Copyright 2019 Peter Dimov
5//
6// Distributed under the Boost Software License, Version 1.0.
7// http://www.boost.org/LICENSE_1_0.txt
8
9#include <cstdint>
10#include <cstddef>
11
12namespace boost
13{
14namespace endian
15{
16namespace detail
17{
18
19template<std::size_t N> struct integral_by_size
20{
21};
22
23template<> struct integral_by_size<1>
24{
25 typedef std::uint8_t type;
26};
27
28template<> struct integral_by_size<2>
29{
30 typedef std::uint16_t type;
31};
32
33template<> struct integral_by_size<4>
34{
35 typedef std::uint32_t type;
36};
37
38template<> struct integral_by_size<8>
39{
40 typedef std::uint64_t type;
41};
42
43#if defined(__SIZEOF_INT128__)
44
45template<> struct integral_by_size<16>
46{
47 typedef __uint128_t type;
48};
49
50#endif
51
52} // namespace detail
53} // namespace endian
54} // namespace boost
55
56#endif // BOOST_ENDIAN_DETAIL_INTEGRAL_BY_SIZE_HPP_INCLUDED
57

source code of boost/libs/endian/include/boost/endian/detail/integral_by_size.hpp