1
0
mirror of synced 2024-12-13 08:21:07 +01:00
ImHex/plugins/libimhex/include/hex/helpers/literals.hpp

23 lines
647 B
C++
Raw Normal View History

2021-09-06 16:15:05 +02:00
#pragma once
namespace hex::literals {
/* Byte literals */
2021-09-06 23:08:02 +02:00
constexpr static inline unsigned long long operator ""_Bytes(unsigned long long bytes) noexcept {
2021-09-06 16:15:05 +02:00
return bytes;
}
2021-09-06 23:08:02 +02:00
constexpr static inline unsigned long long operator ""_kiB(unsigned long long kiB) noexcept {
2021-09-06 16:15:05 +02:00
return operator ""_Bytes(kiB * 1024);
}
2021-09-06 23:08:02 +02:00
constexpr static inline unsigned long long operator ""_MiB(unsigned long long MiB) noexcept {
2021-09-06 16:15:05 +02:00
return operator ""_kiB(MiB * 1024);
}
2021-09-06 23:08:02 +02:00
constexpr static inline unsigned long long operator ""_GiB(unsigned long long GiB) noexcept {
2021-09-06 16:15:05 +02:00
return operator ""_MiB(GiB * 1024);
}
}