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 <boost/cstdint.hpp> 10 #include <boost/config.hpp> 11 #include <cstddef> 12 13 namespace boost 14 { 15 namespace endian 16 { 17 namespace detail 18 { 19 20 template<std::size_t N> struct integral_by_size 21 { 22 }; 23 24 template<> struct integral_by_size<1> 25 { 26 typedef uint8_t type; 27 }; 28 29 template<> struct integral_by_size<2> 30 { 31 typedef uint16_t type; 32 }; 33 34 template<> struct integral_by_size<4> 35 { 36 typedef uint32_t type; 37 }; 38 39 template<> struct integral_by_size<8> 40 { 41 typedef uint64_t type; 42 }; 43 44 #if defined(BOOST_HAS_INT128) 45 46 template<> struct integral_by_size<16> 47 { 48 typedef uint128_type type; 49 }; 50 51 #endif 52 53 } // namespace detail 54 } // namespace endian 55 } // namespace boost 56 57 #endif // BOOST_ENDIAN_DETAIL_INTEGRAL_BY_SIZE_HPP_INCLUDED 58