From 6c2989d95d2871220825929fdde57310f83fd7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Mon, 1 Jan 2024 20:03:21 -0800 Subject: [PATCH] Cleanup. --- include/bx/inline/math.inl | 6 +++--- include/bx/math.h | 4 ++-- tests/math_test.cpp | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/bx/inline/math.inl b/include/bx/inline/math.inl index b5b3a28..2cbe076 100644 --- a/include/bx/inline/math.inl +++ b/include/bx/inline/math.inl @@ -138,15 +138,15 @@ namespace bx return float( (0.0f < _a) - (0.0f > _a) ); } - inline BX_CONSTEXPR_FUNC bool signbit(float _a) + inline BX_CONSTEXPR_FUNC bool signBit(float _a) { return -0.0f == _a ? 0.0f != _a : 0.0f > _a; } - inline BX_CONSTEXPR_FUNC float copysign(float _value, float _sign) + inline BX_CONSTEXPR_FUNC float copySign(float _value, float _sign) { #if BX_COMPILER_MSVC - return signbit(_value) != signbit(_sign) ? -_value : _value; + return signBit(_value) != signBit(_sign) ? -_value : _value; #else return __builtin_copysign(_value, _sign); #endif // BX_COMPILER_MSVC diff --git a/include/bx/math.h b/include/bx/math.h index 1dee710..29dba9f 100644 --- a/include/bx/math.h +++ b/include/bx/math.h @@ -184,7 +184,7 @@ namespace bx /// /// @returns `true` if `_a` is less than zero, otherwise returns `false`. /// - BX_CONSTEXPR_FUNC bool signbit(float _a); + BX_CONSTEXPR_FUNC bool signBit(float _a); /// Returns value with the magnitude `_value`, and the sign of `_sign`. /// @@ -193,7 +193,7 @@ namespace bx /// /// @returns Value with the magnitude `_value`, and the sign of `_sign`. /// - BX_CONSTEXPR_FUNC float copysign(float _value, float _sign); + BX_CONSTEXPR_FUNC float copySign(float _value, float _sign); /// Returns the absolute of _a. /// diff --git a/tests/math_test.cpp b/tests/math_test.cpp index 4c24c16..5166407 100644 --- a/tests/math_test.cpp +++ b/tests/math_test.cpp @@ -556,23 +556,23 @@ TEST_CASE("sign", "[math][libm]") REQUIRE( 1 == bx::sign( bx::kFloatInfinity) ); } -TEST_CASE("signbit", "[math][libm]") +TEST_CASE("signBit", "[math][libm]") { - STATIC_REQUIRE( bx::signbit(-0.1389f) ); - STATIC_REQUIRE(!bx::signbit( 0.0000f) ); - STATIC_REQUIRE(!bx::signbit( 0.1389f) ); + STATIC_REQUIRE( bx::signBit(-0.1389f) ); + STATIC_REQUIRE(!bx::signBit( 0.0000f) ); + STATIC_REQUIRE(!bx::signBit( 0.1389f) ); - REQUIRE( bx::signbit(-bx::kFloatInfinity) ); - REQUIRE(!bx::signbit( bx::kFloatInfinity) ); + REQUIRE( bx::signBit(-bx::kFloatInfinity) ); + REQUIRE(!bx::signBit( bx::kFloatInfinity) ); } -TEST_CASE("copysign", "[math][libm]") +TEST_CASE("copySign", "[math][libm]") { - STATIC_REQUIRE( 0.1389f == bx::copysign(-0.1389f, +1389) ); - STATIC_REQUIRE(-0.0000f == bx::copysign( 0.0000f, -1389) ); - STATIC_REQUIRE(-0.1389f == bx::copysign( 0.1389f, -1389) ); + STATIC_REQUIRE( 0.1389f == bx::copySign(-0.1389f, +1389) ); + STATIC_REQUIRE(-0.0000f == bx::copySign( 0.0000f, -1389) ); + STATIC_REQUIRE(-0.1389f == bx::copySign( 0.1389f, -1389) ); - REQUIRE(-bx::kFloatInfinity == bx::copysign(bx::kFloatInfinity, -1389) ); + REQUIRE(-bx::kFloatInfinity == bx::copySign(bx::kFloatInfinity, -1389) ); } TEST_CASE("bitsToFloat, floatToBits, bitsToDouble, doubleToBits", "[math]")