diff options
| author | 2020-09-03 17:11:51 -0400 | |
|---|---|---|
| committer | 2020-09-03 17:11:51 -0400 | |
| commit | 40c230e0fa1a4fd3677fa98103f207fea55e0d40 (patch) | |
| tree | 89b372fc041c77533ea3f2477e47cdf5f6fbdf3e /src | |
| parent | Merge pull request #4590 from ReinUsesLisp/tsan-sched (diff) | |
| parent | common_funcs: Add missing XOR operators to DECLARE_ENUM_FLAG_OPERATORS (diff) | |
| download | yuzu-40c230e0fa1a4fd3677fa98103f207fea55e0d40.tar.gz yuzu-40c230e0fa1a4fd3677fa98103f207fea55e0d40.tar.xz yuzu-40c230e0fa1a4fd3677fa98103f207fea55e0d40.zip | |
Merge pull request #4578 from lioncash/xor
common_funcs: Add missing XOR operators to DECLARE_ENUM_FLAG_OPERATORS
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/common_funcs.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 98421bced..367b6bf6e 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -64,14 +64,20 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 64 | using T = std::underlying_type_t<type>; \ | 64 | using T = std::underlying_type_t<type>; \ |
| 65 | return static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ | 65 | return static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ |
| 66 | } \ | 66 | } \ |
| 67 | constexpr type& operator|=(type& a, type b) noexcept { \ | 67 | [[nodiscard]] constexpr type operator^(type a, type b) noexcept { \ |
| 68 | using T = std::underlying_type_t<type>; \ | 68 | using T = std::underlying_type_t<type>; \ |
| 69 | a = static_cast<type>(static_cast<T>(a) | static_cast<T>(b)); \ | 69 | return static_cast<type>(static_cast<T>(a) ^ static_cast<T>(b)); \ |
| 70 | } \ | ||
| 71 | constexpr type& operator|=(type& a, type b) noexcept { \ | ||
| 72 | a = a | b; \ | ||
| 70 | return a; \ | 73 | return a; \ |
| 71 | } \ | 74 | } \ |
| 72 | constexpr type& operator&=(type& a, type b) noexcept { \ | 75 | constexpr type& operator&=(type& a, type b) noexcept { \ |
| 73 | using T = std::underlying_type_t<type>; \ | 76 | a = a & b; \ |
| 74 | a = static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ | 77 | return a; \ |
| 78 | } \ | ||
| 79 | constexpr type& operator^=(type& a, type b) noexcept { \ | ||
| 80 | a = a ^ b; \ | ||
| 75 | return a; \ | 81 | return a; \ |
| 76 | } \ | 82 | } \ |
| 77 | [[nodiscard]] constexpr type operator~(type key) noexcept { \ | 83 | [[nodiscard]] constexpr type operator~(type key) noexcept { \ |