From bb966d3e336ce1eee86daca5db00b29a63708d4c Mon Sep 17 00:00:00 2001
From: bunnei <bunneidev@gmail.com>
Date: Tue, 19 Jan 2021 20:53:11 -0800
Subject: [PATCH] common: common_funcs: Add useful kernel macro R_SUCCEED_IF.

---
 src/common/common_funcs.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 49c36765d..842d62ca7 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -112,6 +112,9 @@ __declspec(dllimport) void __stdcall DebugBreak(void);
         }                                                                                          \
     }
 
+/// 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) {