Blame view

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