OGLplus  (0.59.0) a C++ wrapper for rendering APIs

information.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_UNITS_UNIT_SI_INFORMATION_HPP
10 #define EAGINE_UNITS_UNIT_SI_INFORMATION_HPP
11 
12 #include "common.hpp"
13 
14 namespace eagine::units {
15 namespace base {
16 
17 // bit
18 struct bit : unit<amount_of_information, bit> {};
19 
20 // byte
21 using byte = scaled_unit<scales::constant<8>, bit>;
22 
23 } // namespace base
24 
25 template <>
26 struct name_of<base::bit> {
27  static constexpr const char mp_str[] = "bit";
28 };
29 template <>
30 struct symbol_of<base::bit> {
31  static constexpr const char mp_str[] = "b";
32 };
33 
34 template <>
35 struct name_of<base::byte> {
36  static constexpr const char mp_str[] = "byte";
37 };
38 template <>
39 struct symbol_of<base::byte> {
40  static constexpr const char mp_str[] = "B";
41 };
42 
43 // si::base_unit<amount_of_information>
44 template <>
45 struct si::base_unit<base::amount_of_information> : base::bit {};
46 
47 using bit = unit<amount_of_information, si>;
48 
49 using byte = make_scaled_base_dim_unit_t<
50  base::scaled_unit<scales::constant<8>, base::bit>,
51  si>;
52 
53 using kilobyte = make_scaled_base_dim_unit_t<
54  base::
55  scaled_unit<scales::recombined<scales::kilo, scales::constant<8>>, base::bit>,
56  si>;
57 
58 using kibibyte = make_scaled_base_dim_unit_t<
59  base::
60  scaled_unit<scales::recombined<scales::kibi, scales::constant<8>>, base::bit>,
61  si>;
62 
63 using megabyte = make_scaled_base_dim_unit_t<
64  base::
65  scaled_unit<scales::recombined<scales::mega, scales::constant<8>>, base::bit>,
66  si>;
67 
68 using mebibyte = make_scaled_base_dim_unit_t<
69  base::
70  scaled_unit<scales::recombined<scales::mebi, scales::constant<8>>, base::bit>,
71  si>;
72 
73 } // namespace eagine::units
74 
75 #endif // EAGINE_UNITS_UNIT_SI_INFORMATION_HPP
unsigned char byte
Byte type alias.
Definition: types.hpp:24

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).