-
Notifications
You must be signed in to change notification settings - Fork 0
/
literals.hpp
20 lines (15 loc) · 1.23 KB
/
literals.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once
namespace nall {
inline constexpr auto operator"" _Kibit(unsigned long long value) { return value * 1024 / 8; }
inline constexpr auto operator"" _Mibit(unsigned long long value) { return value * 1024 * 1024 / 8; }
inline constexpr auto operator"" _Gibit(unsigned long long value) { return value * 1024 * 1024 * 1024 / 8; }
inline constexpr auto operator"" _Tibit(unsigned long long value) { return value * 1024 * 1024 * 1024 * 1024 / 8; }
inline constexpr auto operator"" _KiB(unsigned long long value) { return value * 1024; }
inline constexpr auto operator"" _MiB(unsigned long long value) { return value * 1024 * 1024; }
inline constexpr auto operator"" _GiB(unsigned long long value) { return value * 1024 * 1024 * 1024; }
inline constexpr auto operator"" _TiB(unsigned long long value) { return value * 1024 * 1024 * 1024 * 1024; }
inline constexpr auto operator"" _KHz(unsigned long long value) { return value * 1000; }
inline constexpr auto operator"" _MHz(unsigned long long value) { return value * 1000 * 1000; }
inline constexpr auto operator"" _GHz(unsigned long long value) { return value * 1000 * 1000 * 1000; }
inline constexpr auto operator"" _THz(unsigned long long value) { return value * 1000 * 1000 * 1000 * 1000; }
}