2021-09-06 16:15:05 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace hex::literals {
|
|
|
|
|
|
|
|
/* Byte literals */
|
|
|
|
|
2023-11-10 20:47:08 +01:00
|
|
|
constexpr static unsigned long long operator""_Bytes(unsigned long long bytes) noexcept {
|
2021-09-06 16:15:05 +02:00
|
|
|
return bytes;
|
|
|
|
}
|
|
|
|
|
2023-11-10 20:47:08 +01:00
|
|
|
constexpr static unsigned long long operator""_KiB(unsigned long long kiB) noexcept {
|
2022-01-24 20:53:17 +01:00
|
|
|
return operator""_Bytes(kiB * 1024);
|
2021-09-06 16:15:05 +02:00
|
|
|
}
|
|
|
|
|
2023-11-10 20:47:08 +01:00
|
|
|
constexpr static unsigned long long operator""_MiB(unsigned long long MiB) noexcept {
|
2022-01-24 20:53:17 +01:00
|
|
|
return operator""_KiB(MiB * 1024);
|
2021-09-06 16:15:05 +02:00
|
|
|
}
|
|
|
|
|
2023-11-10 20:47:08 +01:00
|
|
|
constexpr static unsigned long long operator""_GiB(unsigned long long GiB) noexcept {
|
2022-01-24 20:53:17 +01:00
|
|
|
return operator""_MiB(GiB * 1024);
|
2021-09-06 16:15:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|