summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-06-02 06:34:48 +0200
committerGitHub <noreply@github.com>2021-06-02 06:34:48 +0200
commit377cd301b30aaee015d6981387284ab5cbd7cc3e (patch)
tree88f1d045919187bd67dce2d7bbcaf301046bae6b
parentMerge pull request #6397 from Morph1984/fs_util (diff)
parentcommon_funcs: Move R_ macros to result.h (diff)
downloadyuzu-377cd301b30aaee015d6981387284ab5cbd7cc3e.tar
yuzu-377cd301b30aaee015d6981387284ab5cbd7cc3e.tar.gz
yuzu-377cd301b30aaee015d6981387284ab5cbd7cc3e.tar.bz2
yuzu-377cd301b30aaee015d6981387284ab5cbd7cc3e.tar.lz
yuzu-377cd301b30aaee015d6981387284ab5cbd7cc3e.tar.xz
yuzu-377cd301b30aaee015d6981387284ab5cbd7cc3e.tar.zst
yuzu-377cd301b30aaee015d6981387284ab5cbd7cc3e.zip
-rw-r--r--src/common/common_funcs.h25
-rw-r--r--src/core/hle/result.h25
2 files changed, 25 insertions, 25 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 17d1ee86b..53bd7da60 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -97,17 +97,6 @@ __declspec(dllimport) void __stdcall DebugBreak(void);
return static_cast<T>(key) == 0; \
}
-/// Evaluates a boolean expression, and returns a result unless that expression is true.
-#define R_UNLESS(expr, res) \
- { \
- if (!(expr)) { \
- if (res.IsError()) { \
- LOG_ERROR(Kernel, "Failed with result: {}", res.raw); \
- } \
- return res; \
- } \
- }
-
#define YUZU_NON_COPYABLE(cls) \
cls(const cls&) = delete; \
cls& operator=(const cls&) = delete
@@ -116,20 +105,6 @@ __declspec(dllimport) void __stdcall DebugBreak(void);
cls(cls&&) = delete; \
cls& operator=(cls&&) = delete
-#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; \
- } \
- }
-
-/// Evaluates a boolean expression, and succeeds if that expression is true.
-#define R_SUCCEED_IF(expr) R_UNLESS(!(expr), RESULT_SUCCESS)
-
namespace Common {
[[nodiscard]] constexpr u32 MakeMagic(char a, char b, char c, char d) {
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index 43968386f..df3283fe3 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -358,3 +358,28 @@ ResultVal<std::remove_reference_t<Arg>> MakeResult(Arg&& arg) {
return CONCAT2(check_result_L, __LINE__); \
} \
} while (false)
+
+#define R_SUCCEEDED(res) (res.IsSuccess())
+
+/// Evaluates a boolean expression, and succeeds if that expression is true.
+#define R_SUCCEED_IF(expr) R_UNLESS(!(expr), RESULT_SUCCESS)
+
+/// Evaluates a boolean expression, and returns a result unless that expression is true.
+#define R_UNLESS(expr, res) \
+ { \
+ if (!(expr)) { \
+ if (res.IsError()) { \
+ LOG_ERROR(Kernel, "Failed with result: {}", res.raw); \
+ } \
+ return res; \
+ } \
+ }
+
+/// 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; \
+ } \
+ }