summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-01-16 06:52:18 +0100
committerbunnei <bunneidev@gmail.com>2021-01-29 06:42:25 +0100
commit2fb77adb9f3fca7c4243ffe20df14c45d928fa96 (patch)
treebbf57df6171310eb2d7fde2ebd219a543581e3be /src/common
parenthle: kernel: KThread: Clean up thread priorities. (diff)
downloadyuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.tar
yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.tar.gz
yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.tar.bz2
yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.tar.lz
yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.tar.xz
yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.tar.zst
yuzu-2fb77adb9f3fca7c4243ffe20df14c45d928fa96.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/common_funcs.h11
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);
} \
}
+#define R_SUCCEEDED(res) (res.IsSuccess())
+
+/// Evaluates an expression that returns a result, and returns the result if it would fail.
+#define R_TRY(res_expr) \
+ { \
+ const auto _tmp_r_try_rc = (res_expr); \
+ if (_tmp_r_try_rc.IsError()) { \
+ return _tmp_r_try_rc; \
+ } \
+ }
+
namespace Common {
[[nodiscard]] constexpr u32 MakeMagic(char a, char b, char c, char d) {