qxLib
data.h
Go to the documentation of this file.
1 /**
2 
3  @file data.h
4  @author Khrapov
5  @date 11.08.2025
6  @copyright © Nick Khrapov, 2025. All right reserved.
7 
8 **/
9 #pragma once
10 
11 #include <qx/math/units/base.h>
12 
13 #include <qx/math/common.h>
14 
15 #include <algorithm>
16 
17 namespace qx::units
18 {
19 
20 enum class data
21 {
22  // binary prefixes
23 
24  bits = 0, // 2^0 bits (1 bit)
25  nibbles = 2, // 2^1 bits (4 bits)
26  bytes = 3, // 2^3 bits (8 bits)
27  kibibytes = 13, // 2^13 bits (1024 bytes)
28  mebibytes = 23, // 2^23 bits (1024 kibibytes)
29  gibibytes = 33, // 2^33 bits (1024 mebibytes)
30  tebibytes = 43, // 2^43 bits (1024 gibibytes)
31  pebibytes = 53, // 2^53 bits (1024 tebibytes)
32 
33  _last_binary,
34 
35  // multiplicative prefixes
36 
37  kilobytes = _last_binary + 3, // 10^3 bytes
38  megabytes = _last_binary + 6, // 10^6 bytes (1000 kilobytes)
39  gigabytes = _last_binary + 9, // 10^9 bytes (1000 megabytes)
40  terabytes = _last_binary + 12, // 10^12 bytes (1000 gigabytes)
41  petabytes = _last_binary + 15, // 10^15 bytes (1000 terabytes)
42 
43  _last_multiplicative
44 };
45 
46 } // namespace qx::units
47 
48 #include <qx/math/units/data.inl>