mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-04 02:16:03 -04:00
Fix JUT_ASSERT and several other macros (#2711)
* Fix JUT_ASSERT to be a nested define * Switch names that appear in asserts to be constants instead of defines * Replace `0` in asserts with `NULL` or `FALSE` * Fix fpclassify * Fix ARRAY_SIZE * Use G_CM3D_F_INF * More fixes for fpclassify * Remove FLOAT_LABEL * Remove incorrect FLAG_ON macro * Remove UNK_BSS macro * Silence clangd unused header warning for PCH
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "SSystem/SComponent/c_cc_d.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1));
|
||||
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f);
|
||||
|
||||
/* 80430CB4-80430CC0 05D9D4 000C+00 1/1 2/2 0/0 .bss m_virtual_center__14cCcD_ShapeAttr
|
||||
@@ -224,9 +223,9 @@ void cCcD_Stts::PlusCcMove(f32 x, f32 y, f32 z) {
|
||||
m_cc_move.y += y;
|
||||
m_cc_move.z += z;
|
||||
|
||||
CHECK_FLOAT_CLASS(422, m_cc_move.x);
|
||||
CHECK_FLOAT_CLASS(423, m_cc_move.y);
|
||||
CHECK_FLOAT_CLASS(424, m_cc_move.z);
|
||||
JUT_ASSERT(422, !isnan(m_cc_move.x));
|
||||
JUT_ASSERT(423, !isnan(m_cc_move.y));
|
||||
JUT_ASSERT(424, !isnan(m_cc_move.z));
|
||||
|
||||
CHECK_FLOAT_RANGE(426, m_cc_move.x);
|
||||
CHECK_FLOAT_RANGE(427, m_cc_move.y);
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
#include "SSystem/SComponent/c_cc_s.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
#define CHECK_FLOAT_CLASS(line, x) \
|
||||
JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : \
|
||||
__fpclassifyd((double)(x))) == 1));
|
||||
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !isnan(x));
|
||||
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f);
|
||||
|
||||
/* 80264A6C-80264A94 25F3AC 0028+00 0/0 1/1 0/0 .text __ct__4cCcSFv */
|
||||
@@ -165,7 +163,7 @@ void cCcS::ChkAtTg() {
|
||||
continue;
|
||||
|
||||
cCcD_ShapeAttr* pat_sa = (*pat_obj)->GetShapeAttr();
|
||||
JUT_ASSERT(0, pat_sa != 0);
|
||||
JUT_ASSERT(0, pat_sa != NULL);
|
||||
|
||||
for (cCcD_Obj** ptg_obj = mpObjTg; ptg_obj < objTgEnd; ++ptg_obj) {
|
||||
if (*ptg_obj == NULL || !(*ptg_obj)->ChkTgSet())
|
||||
@@ -176,7 +174,7 @@ void cCcS::ChkAtTg() {
|
||||
continue;
|
||||
|
||||
cCcD_ShapeAttr* ptg_sa = (*ptg_obj)->GetShapeAttr();
|
||||
JUT_ASSERT(0, ptg_sa != 0);
|
||||
JUT_ASSERT(0, ptg_sa != NULL);
|
||||
|
||||
static cXyz cross;
|
||||
bool didCross = pat_sa->CrossAtTg(*ptg_sa, &cross);
|
||||
@@ -225,7 +223,7 @@ void cCcS::ChkCo() {
|
||||
continue;
|
||||
|
||||
cCcD_ShapeAttr* pco1_sa = (*pco1_obj)->GetShapeAttr();
|
||||
JUT_ASSERT(0, pco1_sa != 0);
|
||||
JUT_ASSERT(0, pco1_sa != NULL);
|
||||
|
||||
for (cCcD_Obj** pco2_obj = pco1_obj + 1; pco2_obj < objCoEnd; ++pco2_obj) {
|
||||
if (*pco2_obj == NULL || !(*pco2_obj)->ChkCoSet())
|
||||
@@ -236,7 +234,7 @@ void cCcS::ChkCo() {
|
||||
continue;
|
||||
|
||||
cCcD_ShapeAttr* pco2_sa = (*pco2_obj)->GetShapeAttr();
|
||||
JUT_ASSERT(0, pco2_sa != 0);
|
||||
JUT_ASSERT(0, pco2_sa != NULL);
|
||||
|
||||
f32 cross_len;
|
||||
if (pco1_sa->CrossCo(*pco2_sa, &cross_len)) {
|
||||
@@ -456,7 +454,7 @@ void cCcS::CalcArea() {
|
||||
for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) {
|
||||
if (*pset_obj != NULL) {
|
||||
cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr();
|
||||
JUT_ASSERT(0, pset_sa != 0);
|
||||
JUT_ASSERT(0, pset_sa != NULL);
|
||||
|
||||
pset_sa->CalcAabBox();
|
||||
aab.SetMinMax(pset_sa->GetWorkAab());
|
||||
@@ -467,7 +465,7 @@ void cCcS::CalcArea() {
|
||||
for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) {
|
||||
if (*pset_obj != NULL) {
|
||||
const cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr();
|
||||
JUT_ASSERT(0, pset_sa != 0);
|
||||
JUT_ASSERT(0, pset_sa != NULL);
|
||||
|
||||
cCcD_DivideInfo* divideInfo = &(*pset_obj)->GetDivideInfo();
|
||||
mDivideArea.CalcDivideInfo(divideInfo, pset_sa->GetWorkAab(),
|
||||
|
||||
@@ -40,8 +40,8 @@ bool cM3dGAab::TopPlaneYUnder(f32 y) const {
|
||||
|
||||
/* 8026ECF8-8026ED1C 0024+00 s=0 e=6 z=0 None .text ClearForMinMax__8cM3dGAabFv */
|
||||
void cM3dGAab::ClearForMinMax() {
|
||||
mMin.x = mMin.y = mMin.z = 1000000000.0f;
|
||||
mMax.x = mMax.y = mMax.z = -1000000000.0f;
|
||||
mMin.x = mMin.y = mMin.z = G_CM3D_F_INF;
|
||||
mMax.x = mMax.y = mMax.z = -G_CM3D_F_INF;
|
||||
}
|
||||
|
||||
/* 8026ED1C-8026ED60 0044+00 s=1 e=3 z=0 None .text SetMinMax__8cM3dGAabFRC4cXyz */
|
||||
|
||||
@@ -96,7 +96,7 @@ cXyz cXyz::normZC() const {
|
||||
|
||||
/* 80266EF4-80266F48 0054+00 s=0 e=13 z=17 None .text normalize__4cXyzFv */
|
||||
cXyz cXyz::normalize() {
|
||||
JUT_ASSERT(285, isNearZeroSquare() == 0);
|
||||
JUT_ASSERT(285, isNearZeroSquare() == FALSE);
|
||||
PSVECNormalize(this, this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user