summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mai M2021-09-13 17:21:22 -0400
committerGravatar GitHub2021-09-13 17:21:22 -0400
commitedf3da346f4ec0ca492b427f4f693d56e84abc52 (patch)
tree3445012c7f4646f81c1ab3fce49f5b8eb9cba4b4
parentMerge pull request #6944 from FernandoS27/dear-drunk-me (diff)
parentcommon_funcs: Add enum flag bitwise shift operator overloads (diff)
downloadyuzu-edf3da346f4ec0ca492b427f4f693d56e84abc52.tar.gz
yuzu-edf3da346f4ec0ca492b427f4f693d56e84abc52.tar.xz
yuzu-edf3da346f4ec0ca492b427f4f693d56e84abc52.zip
Merge pull request #7005 from Morph1984/enum-bitwise-shift-ops
common_funcs: Add enum flag bitwise shift operator overloads
Diffstat (limited to '')
-rw-r--r--src/common/common_funcs.h16
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)); \