diff options
Diffstat (limited to 'src/common/literals.h')
| -rw-r--r-- | src/common/literals.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/common/literals.h b/src/common/literals.h new file mode 100644 index 000000000..d55fed40b --- /dev/null +++ b/src/common/literals.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | // Copyright 2021 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace Common::Literals { | ||
| 10 | |||
| 11 | constexpr u64 operator""_KiB(unsigned long long int x) { | ||
| 12 | return 1024ULL * x; | ||
| 13 | } | ||
| 14 | |||
| 15 | constexpr u64 operator""_MiB(unsigned long long int x) { | ||
| 16 | return 1024_KiB * x; | ||
| 17 | } | ||
| 18 | |||
| 19 | constexpr u64 operator""_GiB(unsigned long long int x) { | ||
| 20 | return 1024_MiB * x; | ||
| 21 | } | ||
| 22 | |||
| 23 | constexpr u64 operator""_TiB(unsigned long long int x) { | ||
| 24 | return 1024_GiB * x; | ||
| 25 | } | ||
| 26 | |||
| 27 | constexpr u64 operator""_PiB(unsigned long long int x) { | ||
| 28 | return 1024_TiB * x; | ||
| 29 | } | ||
| 30 | |||
| 31 | } // namespace Common::Literals | ||