VERY experimental Nintendo Switch 2 emulator
C++
common: common_funcs: Add a few more useful macros for kernel code.
bunnei39987beb1752
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.hindex 75f3027fb4..49c36765d4 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) {