block/include/nil/crypto3/detail/stream_endian.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2018-2020 Mikhail Komarov <nemo@nil.foundation>
3 //
4 // MIT License
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //---------------------------------------------------------------------------//
24 
25 #ifndef CRYPTO3_STREAM_ENDIAN_HPP
26 #define CRYPTO3_STREAM_ENDIAN_HPP
27 
28 #include <boost/static_assert.hpp>
29 
30 #include <climits>
31 
32 namespace nil {
33  namespace crypto3 {
34  namespace stream_endian {
35  // General versions; There should be no need to use these directly
36 
37  template<int UnitBits>
38  struct big_unit_big_bit { };
39  template<int UnitBits>
40  struct little_unit_little_bit { };
41  template<int UnitBits>
42  struct big_unit_little_bit { };
43  template<int UnitBits>
44  struct little_unit_big_bit { };
45  template<int UnitBits>
46  struct host_unit {
47  BOOST_STATIC_ASSERT(UnitBits % CHAR_BIT == 0);
48  };
49 
50  // Typical, useful instantiations
51 
55 
59 
62 
65 
67 
68  } // namespace stream_endian
69  } // namespace crypto3
70 } // namespace nil
71 
72 #endif // CRYPTO3_STREAM_ENDIAN_HPP
little_unit_big_bit< 8 > little_octet_big_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:65
big_unit_big_bit< 8 > big_octet_big_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:55
little_unit_little_bit< 8 > little_octet_little_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:59
big_unit_big_bit< CHAR_BIT > big_byte_big_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:54
big_unit_little_bit< CHAR_BIT > big_byte_little_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:61
little_unit_little_bit< 1 > little_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:57
host_unit< CHAR_BIT > host_byte
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:67
little_unit_little_bit< CHAR_BIT > little_byte_little_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:58
big_unit_little_bit< 8 > big_octet_little_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:62
big_unit_big_bit< 1 > big_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:53
little_unit_big_bit< CHAR_BIT > little_byte_big_bit
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:64
Definition: pair.hpp:31
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:39
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:43
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:47
BOOST_STATIC_ASSERT(UnitBits % CHAR_BIT==0)
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:45
Definition: algebra/include/nil/crypto3/detail/stream_endian.hpp:41