diff options
| author | 2020-04-17 16:33:08 -0400 | |
|---|---|---|
| committer | 2020-04-17 16:33:08 -0400 | |
| commit | b8f5c71f2d7f819821acf036175cce65ab1ae12c (patch) | |
| tree | 151d7ed4e47536dc0e149a7117387b6a502d7da6 /src/common/common_funcs.h | |
| parent | Merge pull request #3682 from lioncash/uam (diff) | |
| parent | core: hle: Address various feedback & code cleanup. (diff) | |
| download | yuzu-b8f5c71f2d7f819821acf036175cce65ab1ae12c.tar.gz yuzu-b8f5c71f2d7f819821acf036175cce65ab1ae12c.tar.xz yuzu-b8f5c71f2d7f819821acf036175cce65ab1ae12c.zip | |
Merge pull request #3666 from bunnei/new-vmm
Implement a new virtual memory manager
Diffstat (limited to 'src/common/common_funcs.h')
| -rw-r--r-- | src/common/common_funcs.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 052254678..88cf5250a 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -55,6 +55,38 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 55 | // Defined in Misc.cpp. | 55 | // Defined in Misc.cpp. |
| 56 | std::string GetLastErrorMsg(); | 56 | std::string GetLastErrorMsg(); |
| 57 | 57 | ||
| 58 | #define DECLARE_ENUM_FLAG_OPERATORS(type) \ | ||
| 59 | constexpr type operator|(type a, type b) noexcept { \ | ||
| 60 | using T = std::underlying_type_t<type>; \ | ||
| 61 | return static_cast<type>(static_cast<T>(a) | static_cast<T>(b)); \ | ||
| 62 | } \ | ||
| 63 | constexpr type operator&(type a, type b) noexcept { \ | ||
| 64 | using T = std::underlying_type_t<type>; \ | ||
| 65 | return static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ | ||
| 66 | } \ | ||
| 67 | constexpr type& operator|=(type& a, type b) noexcept { \ | ||
| 68 | using T = std::underlying_type_t<type>; \ | ||
| 69 | a = static_cast<type>(static_cast<T>(a) | static_cast<T>(b)); \ | ||
| 70 | return a; \ | ||
| 71 | } \ | ||
| 72 | constexpr type& operator&=(type& a, type b) noexcept { \ | ||
| 73 | using T = std::underlying_type_t<type>; \ | ||
| 74 | a = static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ | ||
| 75 | return a; \ | ||
| 76 | } \ | ||
| 77 | constexpr type operator~(type key) noexcept { \ | ||
| 78 | using T = std::underlying_type_t<type>; \ | ||
| 79 | return static_cast<type>(~static_cast<T>(key)); \ | ||
| 80 | } \ | ||
| 81 | constexpr bool True(type key) noexcept { \ | ||
| 82 | using T = std::underlying_type_t<type>; \ | ||
| 83 | return static_cast<T>(key) != 0; \ | ||
| 84 | } \ | ||
| 85 | constexpr bool False(type key) noexcept { \ | ||
| 86 | using T = std::underlying_type_t<type>; \ | ||
| 87 | return static_cast<T>(key) == 0; \ | ||
| 88 | } | ||
| 89 | |||
| 58 | namespace Common { | 90 | namespace Common { |
| 59 | 91 | ||
| 60 | constexpr u32 MakeMagic(char a, char b, char c, char d) { | 92 | constexpr u32 MakeMagic(char a, char b, char c, char d) { |