diff options
Diffstat (limited to 'src/common/common_funcs.h')
| -rw-r--r-- | src/common/common_funcs.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 1e74d6930..4c1e29de6 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -61,6 +61,14 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 61 | using T = std::underlying_type_t<type>; \ | 61 | using T = std::underlying_type_t<type>; \ |
| 62 | return static_cast<type>(static_cast<T>(a) ^ static_cast<T>(b)); \ | 62 | return static_cast<type>(static_cast<T>(a) ^ static_cast<T>(b)); \ |
| 63 | } \ | 63 | } \ |
| 64 | [[nodiscard]] constexpr type operator<<(type a, type b) noexcept { \ | ||
| 65 | using T = std::underlying_type_t<type>; \ | ||
| 66 | return static_cast<type>(static_cast<T>(a) << static_cast<T>(b)); \ | ||
| 67 | } \ | ||
| 68 | [[nodiscard]] constexpr type operator>>(type a, type b) noexcept { \ | ||
| 69 | using T = std::underlying_type_t<type>; \ | ||
| 70 | return static_cast<type>(static_cast<T>(a) >> static_cast<T>(b)); \ | ||
| 71 | } \ | ||
| 64 | constexpr type& operator|=(type& a, type b) noexcept { \ | 72 | constexpr type& operator|=(type& a, type b) noexcept { \ |
| 65 | a = a | b; \ | 73 | a = a | b; \ |
| 66 | return a; \ | 74 | return a; \ |
| @@ -73,6 +81,14 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 73 | a = a ^ b; \ | 81 | a = a ^ b; \ |
| 74 | return a; \ | 82 | return a; \ |
| 75 | } \ | 83 | } \ |
| 84 | constexpr type& operator<<=(type& a, type b) noexcept { \ | ||
| 85 | a = a << b; \ | ||
| 86 | return a; \ | ||
| 87 | } \ | ||
| 88 | constexpr type& operator>>=(type& a, type b) noexcept { \ | ||
| 89 | a = a >> b; \ | ||
| 90 | return a; \ | ||
| 91 | } \ | ||
| 76 | [[nodiscard]] constexpr type operator~(type key) noexcept { \ | 92 | [[nodiscard]] constexpr type operator~(type key) noexcept { \ |
| 77 | using T = std::underlying_type_t<type>; \ | 93 | using T = std::underlying_type_t<type>; \ |
| 78 | return static_cast<type>(~static_cast<T>(key)); \ | 94 | return static_cast<type>(~static_cast<T>(key)); \ |