15 #ifndef LARDATAALG_UTILITIES_QUANTITIES_DATASIZE_H 16 #define LARDATAALG_UTILITIES_QUANTITIES_DATASIZE_H 23 #include <string_view> 33 static constexpr
auto symbol =
"B"sv;
34 static constexpr
auto name =
"byte"sv;
42 using kibi = std::ratio<(1LL << 10)>;
45 using mebi = std::ratio<(1LL << 20)>;
48 using gibi = std::ratio<(1LL << 30)>;
51 using tebi = std::ratio<(1LL << 40)>;
54 using pebi = std::ratio<(1LL << 50)>;
57 using exbi = std::ratio<(1LL << 60)>;
79 template <
typename R,
typename T =
unsigned long long int>
86 template <
typename T =
unsigned long long int>
90 template <
typename T =
unsigned long long int>
103 template <
typename T =
unsigned long long int>
107 template <
typename T =
unsigned long long int>
120 template <
typename T =
unsigned long long int>
124 template <
typename T =
unsigned long long int>
137 template <
typename T =
unsigned long long int>
141 template <
typename T =
unsigned long long int>
154 template <
typename T =
unsigned long long int>
158 template <
typename T =
unsigned long long int>
171 template <
typename T =
unsigned long long int>
175 template <
typename T =
unsigned long long int>
188 template <
typename T =
unsigned long long int>
192 template <
typename T =
unsigned long long int>
219 namespace datasize_literals {
223 constexpr
byte operator""_B(
long double v)
225 return byte{
static_cast<unsigned long long int>(v)};
227 constexpr
byte operator""_B(
unsigned long long int v)
237 return kibibyte{
static_cast<unsigned long long int>(v)};
239 constexpr
kibibyte operator""_kiB(
unsigned long long int v)
249 return mebibyte{
static_cast<unsigned long long int>(v)};
251 constexpr
mebibyte operator""_MiB(
unsigned long long int v)
261 return gibibyte{
static_cast<unsigned long long int>(v)};
263 constexpr
gibibyte operator""_GiB(
unsigned long long int v)
273 return tebibyte{
static_cast<unsigned long long int>(v)};
275 constexpr
tebibyte operator""_TiB(
unsigned long long int v)
285 return pebibyte{
static_cast<unsigned long long int>(v)};
287 constexpr
pebibyte operator""_PiB(
unsigned long long int v)
297 return exbibyte{
static_cast<unsigned long long int>(v)};
299 constexpr
exbibyte operator""_EiB(
unsigned long long int v)
322 static constexpr
auto symbol() {
return "ki"sv; }
325 static constexpr
auto name() {
return "kibi"sv; }
334 static constexpr
auto symbol() {
return "Mi"sv; }
337 static constexpr
auto name() {
return "mebi"sv; }
346 static constexpr
auto symbol() {
return "Gi"sv; }
349 static constexpr
auto name() {
return "gibi"sv; }
358 static constexpr
auto symbol() {
return "Ti"sv; }
361 static constexpr
auto name() {
return "tebi"sv; }
370 static constexpr
auto symbol() {
return "Pi"sv; }
373 static constexpr
auto name() {
return "pebi"sv; }
382 static constexpr
auto symbol() {
return "Ei"sv; }
385 static constexpr
auto name() {
return "exbi"sv; }
393 #endif // LARDATAALG_UTILITIES_QUANTITIES_DATASIZE_H
static constexpr auto name()
Returns the full name of the prefix.
static constexpr auto name()
Returns the full name of the prefix.
static constexpr auto symbol()
Returns the symbol of the prefix.
static constexpr auto symbol()
Returns the symbol of the prefix.
kibibyte_as<> kibibyte
Type of data size stored in kibibytes, in long long precision.
exbibyte_as<> exbibyte
Type of data size stored in exbibytes, in long long precision.
std::ratio<(1LL<< 60)> exbi
Factor 2^60.
std::ratio<(1LL<< 40)> tebi
Factor 2^40.
tebibyte_as<> tebibyte
Type of data size stored in tebibytes, in long long precision.
static constexpr auto symbol()
Returns the symbol of the prefix.
std::ratio<(1LL<< 30)> gibi
Factor 1'073'741'824 (2^30).
static constexpr auto symbol()
Returns the symbol of the prefix.
static constexpr auto name()
Returns the full name of the prefix.
mebibyte_as<> mebibyte
Type of data size stored in mebibytes, in long long precision.
Infrastructure for the quantities library.
A value measured in the specified unit.
std::ratio<(1LL<< 50)> pebi
Factor 2^50.
static constexpr auto symbol()
Returns the symbol of the prefix.
static constexpr auto symbol()
Returns the symbol of the prefix.
Numeric variable proxies with embedded unit of measurement.
pebibyte_as<> pebibyte
Type of data size stored in pebibytes, in long long precision.
static constexpr auto name()
Returns the full name of the prefix.
byte_as<> byte
Type of data size stored in bytes, in long long precision.
static constexpr auto name()
Returns the full name of the prefix.
gibibyte_as<> gibibyte
Type of data size stored in pebibytes, in long long precision.
Types of variables with a unit.
std::ratio<(1LL<< 10)> kibi
Factor 1'024 (2^10).
std::ratio<(1LL<< 20)> mebi
Factor 1'048'576 (2^20).
static constexpr auto name()
Returns the full name of the prefix.