Move abs and fabsf to std namespace

This commit is contained in:
LagoLunatic
2024-08-07 12:55:30 -04:00
parent d2b9d15efb
commit d287e79ab0
40 changed files with 99 additions and 106 deletions
+2 -4
View File
@@ -152,7 +152,6 @@ void cBgW::ClassifyPlane() {
return;
s32 i = 0;
f32 eps = G_CM3D_F_ABS_MIN;
int roof, wall, ground;
for (; i < pm_bgd->m_b_num; i++) {
@@ -174,9 +173,8 @@ void cBgW::ClassifyPlane() {
for (s32 j = startTri; j <= lastTri; j++) {
cBgW_TriElm* tri_elm = &pm_tri[j];
/* cM3d_isZero */
f32 ny = tri_elm->m_plane.mNormal.y;
if (fabsf(tri_elm->m_plane.mNormal.x) < eps && fabsf(tri_elm->m_plane.mNormal.y) < eps && fabsf(tri_elm->m_plane.mNormal.z) < eps)
f32 ny = tri_elm->m_plane.GetNP()->y;
if (cM3d_IsZero(tri_elm->m_plane.GetNP()->x) && cM3d_IsZero(tri_elm->m_plane.GetNP()->y) && cM3d_IsZero(tri_elm->m_plane.GetNP()->z))
continue;
if (cBgW_CheckBGround(ny)) {
+1 -1
View File
@@ -260,7 +260,7 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos
if (obj1->GetStts()->GetActor() != NULL && obj1->GetStts()->GetActor() == obj2->GetStts()->GetActor()) {
return;
}
if (fabsf(cross_len) < (1.0f / 125.0f)) {
if (std::fabsf(cross_len) < (1.0f / 125.0f)) {
return;
}
+1 -1
View File
@@ -50,7 +50,7 @@ f32 cLib_addCalc(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) {
}
}
}
return fabsf(target - *pValue);
return std::fabsf(target - *pValue);
}
/* 802529A4-802529E8 .text cLib_addCalc2__FPffff */
+9 -9
View File
@@ -130,7 +130,7 @@ f32 cM3d_SignedLenPlaAndPos(const cM3dGPla* plane, const Vec* pos) {
void cM3d_CalcPla(const Vec* p0, const Vec* p1, const Vec* p2, Vec* pDst, f32* pT) {
cM3d_VectorProduct(p0, p1, p2, pDst);
f32 t = VECMag(pDst);
if (fabsf(t) >= 0.02f) {
if (std::fabsf(t) >= 0.02f) {
VECScale(pDst, pDst, 1.0f / t);
*pT = -VECDotProduct(pDst, p0);
} else {
@@ -232,7 +232,7 @@ int cM3d_Check_LinLin(const cM3dGLin* lin_a, const cM3dGLin* lin_b, f32* dst_a,
f32 tmpF = -VECDotProduct(&linAVec, &linBVec);
f32 tmpF2 = VECDotProduct(&tmp, &linAVec);
VECSquareMag(&tmp); // result not used
f32 tmpF3 = fabsf(1.0f - (tmpF * tmpF));
f32 tmpF3 = std::fabsf(1.0f - (tmpF * tmpF));
if (!cM3d_IsZero(tmpF3)) {
f32 tmpF4 = -VECDotProduct(&tmp, &linBVec);
f32 tmpF7 = 1.0f / tmpF3;
@@ -424,9 +424,9 @@ bool cM3d_Cross_LinTri(const cM3dGLin* lin, const cM3dGTri* tri, Vec* dst, bool
if (!cM3d_Cross_LinPla(lin, tri, dst, a, b)) {
return false;
}
if ((fabsf(tri->GetNP()->x) < 0.008f || cM3d_CrossX_Tri(tri, dst)) &&
(fabsf(tri->GetNP()->y) < 0.008f || cM3d_CrossY_Tri(tri, dst)) &&
(fabsf(tri->GetNP()->z) < 0.008f || cM3d_CrossZ_Tri(tri, dst))
if ((std::fabsf(tri->GetNP()->x) < 0.008f || cM3d_CrossX_Tri(tri, dst)) &&
(std::fabsf(tri->GetNP()->y) < 0.008f || cM3d_CrossY_Tri(tri, dst)) &&
(std::fabsf(tri->GetNP()->z) < 0.008f || cM3d_CrossZ_Tri(tri, dst))
) {
return true;
} else {
@@ -658,9 +658,9 @@ int cM3d_2PlaneCrossLine(const cM3dGPla& pPlaneA, const cM3dGPla& pPlaneB, cM3dG
if (cM3d_IsZero(tmp.x) && cM3d_IsZero(tmp.y) && cM3d_IsZero(tmp.z)) {
return 0;
} else {
f32 absTX = fabsf(tmp.x);
f32 absTY = fabsf(tmp.y);
f32 absTZ = fabsf(tmp.z);
f32 absTX = std::fabsf(tmp.x);
f32 absTY = std::fabsf(tmp.y);
f32 absTZ = std::fabsf(tmp.z);
if (absTX >= absTY && absTX >= absTZ) {
cM3d_PlaneCrossLineProcWork(pPlaneA.GetNP()->y, pPlaneA.GetNP()->z, pPlaneB.GetNP()->y,
pPlaneB.GetNP()->z, tmp.x, pPlaneA.GetD(), pPlaneB.GetD(),
@@ -753,7 +753,7 @@ int cM3d_2PlaneLinePosNearPos(const cM3dGPla& p0, const cM3dGPla& p1, const Vec*
/* 80251C44-80251CC4 .text cM3d_CrawVec__FRC3VecRC3VecP3Vec */
void cM3d_CrawVec(const Vec& v0, const Vec& v1, Vec* pDst) {
Vec tmp;
f32 sq = fabsf(v1.x * v0.x + v1.y * v0.y + v1.z * v0.z);
f32 sq = std::fabsf(v1.x * v0.x + v1.y * v0.y + v1.z * v0.z);
VECScale(&v0, &tmp, sq);
VECAdd(&tmp, &v1, pDst);
}
+3 -3
View File
@@ -117,13 +117,13 @@ u16 U_GetAtanTable(float f0, float f1) {
/* 802460D0-80246270 .text cM_atan2s__Fff */
s16 cM_atan2s(float f0, float f1) {
u32 retVar;
if (fabsf(f0) < G_CM3D_F_ABS_MIN) {
if (cM3d_IsZero(f0)) {
if (f1 >= 0.0f) {
retVar = 0;
} else {
retVar = 0x8000;
}
} else if (fabsf(f1) < G_CM3D_F_ABS_MIN) {
} else if (cM3d_IsZero(f1)) {
if (f0 >= 0.0f) {
retVar = 0x4000;
} else {
@@ -178,7 +178,7 @@ float cM_rnd(void) {
r0 = (r0 * 0xAB) % 0x763D;
r1 = (r1 * 0xAC) % 0x7663;
r2 = (r2 * 0xAA) % 0x7673;
return fabsf(fmod(r0 / 30269.0f + r1 / 30307.0f + r2 / 30323.0f, 1.0));
return std::fabsf(fmod(r0 / 30269.0f + r1 / 30307.0f + r2 / 30323.0f, 1.0));
}
/* 802463B0-802463E8 .text cM_rndF__Ff */
+3 -2
View File
@@ -141,8 +141,9 @@ bool cXyz::operator!=(const Vec& vec) const {
/* 80245CE4-80245D48 .text isZero__4cXyzCFv */
bool cXyz::isZero(void) const {
return fabsf(this->x) < 3.8146972e-06f && fabsf(this->y) < 3.8146972e-06f &&
fabsf(this->z) < 3.8146972e-06f;
return std::fabsf(this->x) < 3.8146972e-06f &&
std::fabsf(this->y) < 3.8146972e-06f &&
std::fabsf(this->z) < 3.8146972e-06f;
}
// Unused, but must be in .rodata to match