summaryrefslogtreecommitdiff
path: root/include/JSystem/JUtility
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2024-03-09 17:05:34 -0500
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2024-03-09 17:05:34 -0500
commit64dd688dddbc4d00e3fa629d0348632df2c1fa9e (patch)
treee4c86be5d09863630d91b465845857711beea26d /include/JSystem/JUtility
parent24b8501d3313202c37c8abb4dc4fb9e24fba1842 (diff)
Make JUT_ASSERT macro more accurate
(COND) == 0 and !(COND) both only match sometimes, but (void)((COND) || ...) seems to work all the time.
Diffstat (limited to 'include/JSystem/JUtility')
-rw-r--r--include/JSystem/JUtility/JUTAssert.h14
1 files changed, 1 insertions, 13 deletions
diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h
index 6d01dd5a..f71c17f0 100644
--- a/include/JSystem/JUtility/JUTAssert.h
+++ b/include/JSystem/JUtility/JUTAssert.h
@@ -4,11 +4,7 @@
#include "dolphin/types.h"
#include "dolphin/os/OS.h"
-#define JUT_ASSERT(LINE, COND) \
- if ((COND) == 0) { \
- JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND); \
- OSPanic(__FILE__, LINE, "Halt"); \
- }
+#define JUT_ASSERT(LINE, COND) (void)((COND) || (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND), OSPanic(__FILE__, LINE, "Halt"), 0));
// Favored by JAI (JAudio)
#define JUT_ASSERT_MSG(LINE, COND, MSG) \
@@ -20,14 +16,6 @@
} \
}
-// Some asserts on floats have the wrong codegen with JUT_ASSERT's (COND) == 0 check.
-// Using !(COND) instead fixes them.
-#define JUT_ASSERT_FLOAT(LINE, COND) \
- if (!(COND)) { \
- JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND); \
- OSPanic(__FILE__, LINE, "Halt"); \
- }
-
#define JUT_PANIC(LINE) \
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, "0"); \
OSPanic(__FILE__, LINE, "Halt");