diff --git a/include/bx/inline/math.inl b/include/bx/inline/math.inl index 9ce3cb4..0d75da2 100644 --- a/include/bx/inline/math.inl +++ b/include/bx/inline/math.inl @@ -154,8 +154,8 @@ namespace bx inline bool fequal(float _a, float _b, float _epsilon) { // http://realtimecollisiondetection.net/blog/?p=89 - const float lhs = fabsolute(_a - _b); - const float rhs = _epsilon * fmax3(1.0f, fabsolute(_a), fabsolute(_b) ); + const float lhs = fabs(_a - _b); + const float rhs = _epsilon * fmax3(1.0f, fabs(_a), fabs(_b) ); return lhs <= rhs; } @@ -226,9 +226,9 @@ namespace bx inline void vec3Abs(float* _result, const float* _a) { - _result[0] = fabsolute(_a[0]); - _result[1] = fabsolute(_a[1]); - _result[2] = fabsolute(_a[2]); + _result[0] = fabs(_a[0]); + _result[1] = fabs(_a[1]); + _result[2] = fabs(_a[2]); } inline void vec3Neg(float* _result, const float* _a) @@ -348,7 +348,7 @@ namespace bx const float ny = _n[1]; const float nz = _n[2]; - if (bx::fabsolute(nx) > bx::fabsolute(nz) ) + if (bx::fabs(nx) > bx::fabs(nz) ) { float invLen = 1.0f / bx::fsqrt(nx*nx + nz*nz); _t[0] = -nz * invLen; diff --git a/include/bx/math.h b/include/bx/math.h index 8bf042c..6c637d6 100644 --- a/include/bx/math.h +++ b/include/bx/math.h @@ -113,7 +113,7 @@ namespace bx float fsign(float _a); /// - float fabsolute(float _a); + float fabs(float _a); /// float fsq(float _a); diff --git a/src/math.cpp b/src/math.cpp index dad45ba..b437d31 100644 --- a/src/math.cpp +++ b/src/math.cpp @@ -20,7 +20,7 @@ namespace bx const float kHuge = HUGE_VALF; #endif // BX_COMPILER_MSVC - float fabsolute(float _a) + float fabs(float _a) { return ::fabsf(_a); } @@ -719,7 +719,7 @@ namespace bx const float dd = qx - fmin(qw, qy); const float ee = 1.0e-10f; - _hsv[0] = fabsolute(qz + (qw - qy) / (6.0f * dd + ee) ); + _hsv[0] = fabs(qz + (qw - qy) / (6.0f * dd + ee) ); _hsv[1] = dd / (qx + ee); _hsv[2] = qx; } @@ -730,9 +730,9 @@ namespace bx const float ss = _hsv[1]; const float vv = _hsv[2]; - const float px = fabsolute(ffract(hh + 1.0f ) * 6.0f - 3.0f); - const float py = fabsolute(ffract(hh + 2.0f/3.0f) * 6.0f - 3.0f); - const float pz = fabsolute(ffract(hh + 1.0f/3.0f) * 6.0f - 3.0f); + const float px = fabs(ffract(hh + 1.0f ) * 6.0f - 3.0f); + const float py = fabs(ffract(hh + 2.0f/3.0f) * 6.0f - 3.0f); + const float pz = fabs(ffract(hh + 1.0f/3.0f) * 6.0f - 3.0f); _rgb[0] = vv * flerp(1.0f, fsaturate(px - 1.0f), ss); _rgb[1] = vv * flerp(1.0f, fsaturate(py - 1.0f), ss); diff --git a/tests/simd_bench.cpp b/tests/simd_bench.cpp index 302a2a0..0f0c9c4 100644 --- a/tests/simd_bench.cpp +++ b/tests/simd_bench.cpp @@ -121,10 +121,10 @@ void simd_bench() for (uint32_t ii = 0; ii < numVertices; ++ii) { float* ptr = (float*)&src[ii]; - ptr[0] = bx::fabsolute(ptr[0]); - ptr[1] = bx::fabsolute(ptr[1]); - ptr[2] = bx::fabsolute(ptr[2]); - ptr[3] = bx::fabsolute(ptr[3]); + ptr[0] = bx::fabs(ptr[0]); + ptr[1] = bx::fabs(ptr[1]); + ptr[2] = bx::fabs(ptr[2]); + ptr[3] = bx::fabs(ptr[3]); } simd_bench_pass(dst, src, numVertices);