diff options
| author | 2021-01-15 21:52:18 -0800 | |
|---|---|---|
| committer | 2021-01-28 21:42:25 -0800 | |
| commit | 2fb77adb9f3fca7c4243ffe20df14c45d928fa96 (patch) | |
| tree | bbf57df6171310eb2d7fde2ebd219a543581e3be /src/common | |
| parent | hle: kernel: KThread: Clean up thread priorities. (diff) | |
| download | yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.tar.gz yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.tar.xz yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.zip | |
common: common_funcs: Add a few more useful macros for kernel code.
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/common_funcs.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 75f3027fb..49c36765d 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -101,6 +101,17 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 101 | } \ | 101 | } \ |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | #define R_SUCCEEDED(res) (res.IsSuccess()) | ||
| 105 | |||
| 106 | /// Evaluates an expression that returns a result, and returns the result if it would fail. | ||
| 107 | #define R_TRY(res_expr) \ | ||
| 108 | { \ | ||
| 109 | const auto _tmp_r_try_rc = (res_expr); \ | ||
| 110 | if (_tmp_r_try_rc.IsError()) { \ | ||
| 111 | return _tmp_r_try_rc; \ | ||
| 112 | } \ | ||
| 113 | } | ||
| 114 | |||
| 104 | namespace Common { | 115 | namespace Common { |
| 105 | 116 | ||
| 106 | [[nodiscard]] constexpr u32 MakeMagic(char a, char b, char c, char d) { | 117 | [[nodiscard]] constexpr u32 MakeMagic(char a, char b, char c, char d) { |