1 // boost/endian/endian.hpp -----------------------------------------------------------// 2 3 // Copyright Beman Dawes 2015 4 5 // Distributed under the Boost Software License, Version 1.0. 6 // See http://www.boost.org/LICENSE_1_0.txt 7 8 // See library home page at http://www.boost.org/libs/endian 9 10 #ifndef BOOST_ENDIAN_ENDIAN_HPP 11 #define BOOST_ENDIAN_ENDIAN_HPP 12 13 #ifndef BOOST_ENDIAN_DEPRECATED_NAMES 14 # error "<boost/endian/endian.hpp> is deprecated. Define BOOST_ENDIAN_DEPRECATED_NAMES to use." 15 #endif 16 17 #include <boost/config/header_deprecated.hpp> 18 19 BOOST_HEADER_DEPRECATED( "<boost/endian/arithmetic.hpp>" ) 20 21 #include <boost/endian/arithmetic.hpp> 22 #include <boost/config.hpp> 23 24 namespace boost 25 { 26 namespace endian 27 { 28 typedef order endianness; 29 typedef align alignment; 30 31 # ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES 32 template <BOOST_SCOPED_ENUM(order) Order, class T, std::size_t n_bits, 33 BOOST_SCOPED_ENUM(align) Align = align::no> 34 using endian = endian_arithmetic<Order, T, n_bits, Align>; 35 # endif 36 37 // unaligned big endian signed integer types 38 typedef endian_arithmetic< order::big, int_least8_t, 8 > big8_t; 39 typedef endian_arithmetic< order::big, int_least16_t, 16 > big16_t; 40 typedef endian_arithmetic< order::big, int_least32_t, 24 > big24_t; 41 typedef endian_arithmetic< order::big, int_least32_t, 32 > big32_t; 42 typedef endian_arithmetic< order::big, int_least64_t, 40 > big40_t; 43 typedef endian_arithmetic< order::big, int_least64_t, 48 > big48_t; 44 typedef endian_arithmetic< order::big, int_least64_t, 56 > big56_t; 45 typedef endian_arithmetic< order::big, int_least64_t, 64 > big64_t; 46 47 // unaligned big endian_arithmetic unsigned integer types 48 typedef endian_arithmetic< order::big, uint_least8_t, 8 > ubig8_t; 49 typedef endian_arithmetic< order::big, uint_least16_t, 16 > ubig16_t; 50 typedef endian_arithmetic< order::big, uint_least32_t, 24 > ubig24_t; 51 typedef endian_arithmetic< order::big, uint_least32_t, 32 > ubig32_t; 52 typedef endian_arithmetic< order::big, uint_least64_t, 40 > ubig40_t; 53 typedef endian_arithmetic< order::big, uint_least64_t, 48 > ubig48_t; 54 typedef endian_arithmetic< order::big, uint_least64_t, 56 > ubig56_t; 55 typedef endian_arithmetic< order::big, uint_least64_t, 64 > ubig64_t; 56 57 // unaligned little endian_arithmetic signed integer types 58 typedef endian_arithmetic< order::little, int_least8_t, 8 > little8_t; 59 typedef endian_arithmetic< order::little, int_least16_t, 16 > little16_t; 60 typedef endian_arithmetic< order::little, int_least32_t, 24 > little24_t; 61 typedef endian_arithmetic< order::little, int_least32_t, 32 > little32_t; 62 typedef endian_arithmetic< order::little, int_least64_t, 40 > little40_t; 63 typedef endian_arithmetic< order::little, int_least64_t, 48 > little48_t; 64 typedef endian_arithmetic< order::little, int_least64_t, 56 > little56_t; 65 typedef endian_arithmetic< order::little, int_least64_t, 64 > little64_t; 66 67 // unaligned little endian_arithmetic unsigned integer types 68 typedef endian_arithmetic< order::little, uint_least8_t, 8 > ulittle8_t; 69 typedef endian_arithmetic< order::little, uint_least16_t, 16 > ulittle16_t; 70 typedef endian_arithmetic< order::little, uint_least32_t, 24 > ulittle24_t; 71 typedef endian_arithmetic< order::little, uint_least32_t, 32 > ulittle32_t; 72 typedef endian_arithmetic< order::little, uint_least64_t, 40 > ulittle40_t; 73 typedef endian_arithmetic< order::little, uint_least64_t, 48 > ulittle48_t; 74 typedef endian_arithmetic< order::little, uint_least64_t, 56 > ulittle56_t; 75 typedef endian_arithmetic< order::little, uint_least64_t, 64 > ulittle64_t; 76 77 // unaligned native endian_arithmetic signed integer types 78 typedef endian_arithmetic< order::native, int_least8_t, 8 > native8_t; 79 typedef endian_arithmetic< order::native, int_least16_t, 16 > native16_t; 80 typedef endian_arithmetic< order::native, int_least32_t, 24 > native24_t; 81 typedef endian_arithmetic< order::native, int_least32_t, 32 > native32_t; 82 typedef endian_arithmetic< order::native, int_least64_t, 40 > native40_t; 83 typedef endian_arithmetic< order::native, int_least64_t, 48 > native48_t; 84 typedef endian_arithmetic< order::native, int_least64_t, 56 > native56_t; 85 typedef endian_arithmetic< order::native, int_least64_t, 64 > native64_t; 86 87 // unaligned native endian_arithmetic unsigned integer types 88 typedef endian_arithmetic< order::native, uint_least8_t, 8 > unative8_t; 89 typedef endian_arithmetic< order::native, uint_least16_t, 16 > unative16_t; 90 typedef endian_arithmetic< order::native, uint_least32_t, 24 > unative24_t; 91 typedef endian_arithmetic< order::native, uint_least32_t, 32 > unative32_t; 92 typedef endian_arithmetic< order::native, uint_least64_t, 40 > unative40_t; 93 typedef endian_arithmetic< order::native, uint_least64_t, 48 > unative48_t; 94 typedef endian_arithmetic< order::native, uint_least64_t, 56 > unative56_t; 95 typedef endian_arithmetic< order::native, uint_least64_t, 64 > unative64_t; 96 97 // aligned native endian_arithmetic typedefs are not provided because 98 // <cstdint> types are superior for this use case 99 100 typedef endian_arithmetic< order::big, int16_t, 16, align::yes > aligned_big16_t; 101 typedef endian_arithmetic< order::big, uint16_t, 16, align::yes > aligned_ubig16_t; 102 typedef endian_arithmetic< order::little, int16_t, 16, align::yes > aligned_little16_t; 103 typedef endian_arithmetic< order::little, uint16_t, 16, align::yes > aligned_ulittle16_t; 104 105 typedef endian_arithmetic< order::big, int32_t, 32, align::yes > aligned_big32_t; 106 typedef endian_arithmetic< order::big, uint32_t, 32, align::yes > aligned_ubig32_t; 107 typedef endian_arithmetic< order::little, int32_t, 32, align::yes > aligned_little32_t; 108 typedef endian_arithmetic< order::little, uint32_t, 32, align::yes > aligned_ulittle32_t; 109 110 typedef endian_arithmetic< order::big, int64_t, 64, align::yes > aligned_big64_t; 111 typedef endian_arithmetic< order::big, uint64_t, 64, align::yes > aligned_ubig64_t; 112 typedef endian_arithmetic< order::little, int64_t, 64, align::yes > aligned_little64_t; 113 typedef endian_arithmetic< order::little, uint64_t, 64, align::yes > aligned_ulittle64_t; 114 115 } // namespace endian 116 } // namespace boost 117 118 #endif //BOOST_ENDIAN_ENDIAN_HPP 119