summaryrefslogtreecommitdiff
path: root/include/JSystem/JUtility
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2023-10-18 23:29:27 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2023-10-18 23:29:27 -0400
commit7e360ed3caa51dd4e5aa0ced6aaea26d552e2682 (patch)
treeec79eaae51274ef0606e3faadb829c3d7927b587 /include/JSystem/JUtility
parent1299f85522946aad75288ed16068545442cfc09d (diff)
c_m2d match, add JUT_ASSERT_FLOAT
Diffstat (limited to 'include/JSystem/JUtility')
-rw-r--r--include/JSystem/JUtility/JUTAssert.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h
index d1f509e7..e54d4744 100644
--- a/include/JSystem/JUtility/JUTAssert.h
+++ b/include/JSystem/JUtility/JUTAssert.h
@@ -10,6 +10,14 @@
OSPanic(__FILE__, LINE, "Halt"); \
}
+// 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");