diff --git a/include/ccmath/math/compare/fpclassify.hpp b/include/ccmath/math/compare/fpclassify.hpp index 234aa8f3..28d128b9 100644 --- a/include/ccmath/math/compare/fpclassify.hpp +++ b/include/ccmath/math/compare/fpclassify.hpp @@ -23,15 +23,15 @@ namespace ccm * @return The classification of the number as an integer */ template , bool> = true> - inline constexpr int fpclassify(T num) + constexpr int fpclassify(T num) { - if (ccm::isnan(num)) { return static_cast(ccm::helpers::floating_point_defines::eFP_NAN); } - if (ccm::isinf(num)) { return static_cast(ccm::helpers::floating_point_defines::eFP_INFINITE); } - if (num == static_cast(0)) { return static_cast(ccm::helpers::floating_point_defines::eFP_ZERO); } + if (ccm::isnan(num)) { return ccm::helpers::floating_point_defines::eFP_NAN; } + if (ccm::isinf(num)) { return ccm::helpers::floating_point_defines::eFP_INFINITE; } + if (num == static_cast(0)) { return ccm::helpers::floating_point_defines::eFP_ZERO; } if (ccm::abs(num) < std::numeric_limits::min() && ccm::abs(num) > 0) { - return static_cast(ccm::helpers::floating_point_defines::eFP_SUBNORMAL); + return ccm::helpers::floating_point_defines::eFP_SUBNORMAL; } - return static_cast(ccm::helpers::floating_point_defines::eFP_NORMAL); + return ccm::helpers::floating_point_defines::eFP_NORMAL; } } // namespace ccm diff --git a/include/ccmath/math/compare/isfinite.hpp b/include/ccmath/math/compare/isfinite.hpp index f511b956..970d7b22 100644 --- a/include/ccmath/math/compare/isfinite.hpp +++ b/include/ccmath/math/compare/isfinite.hpp @@ -20,7 +20,7 @@ namespace ccm * @return true if the number has a finite value, false otherwise. */ template , bool> = true> - inline constexpr bool isfinite(T x) + constexpr bool isfinite(T x) { return (!ccm::isnan(x)) && (!ccm::isinf(x)); } @@ -32,7 +32,7 @@ namespace ccm * @return true if the number has a finite value, false otherwise. */ template , bool> = true> - inline constexpr bool isfinite(Integer /* x */) + constexpr bool isfinite(Integer /* x */) { return false; // All integers are finite } diff --git a/include/ccmath/math/compare/isgreater.hpp b/include/ccmath/math/compare/isgreater.hpp index f1cd043d..72f69425 100644 --- a/include/ccmath/math/compare/isgreater.hpp +++ b/include/ccmath/math/compare/isgreater.hpp @@ -20,7 +20,7 @@ namespace ccm * @return true if the first argument is greater than the second, false otherwise. */ template - inline constexpr bool isgreater(T x, T y) noexcept + constexpr bool isgreater(T x, T y) noexcept { return x > y; } @@ -34,7 +34,7 @@ namespace ccm * @return true if the first argument is greater than the second, false otherwise. */ template - inline constexpr bool isgreater(T x, U y) noexcept + constexpr bool isgreater(T x, U y) noexcept { // Find the common type of the two arguments using shared_type = std::common_type_t; diff --git a/include/ccmath/math/compare/isgreaterequal.hpp b/include/ccmath/math/compare/isgreaterequal.hpp index 9b720cb4..36b90c6c 100644 --- a/include/ccmath/math/compare/isgreaterequal.hpp +++ b/include/ccmath/math/compare/isgreaterequal.hpp @@ -20,7 +20,7 @@ namespace ccm * @return true if the first argument is greater than or equal to the second, false otherwise. */ template - inline constexpr bool isgreaterequal(T x, T y) noexcept + constexpr bool isgreaterequal(T x, T y) noexcept { return x >= y; } @@ -34,7 +34,7 @@ namespace ccm * @return true if the first argument is greater than or equal to the second, false otherwise. */ template - inline constexpr bool isgreaterequal(T x, U y) noexcept + constexpr bool isgreaterequal(T x, U y) noexcept { // Find the common type of the two arguments using shared_type = std::common_type_t; diff --git a/include/ccmath/math/compare/isinf.hpp b/include/ccmath/math/compare/isinf.hpp index 8ce37ee9..0685c1f2 100644 --- a/include/ccmath/math/compare/isinf.hpp +++ b/include/ccmath/math/compare/isinf.hpp @@ -20,7 +20,7 @@ namespace ccm * @return True if the number is infinite, false otherwise. */ template , bool> = true> - inline constexpr bool isinf(T x) noexcept + constexpr bool isinf(T x) noexcept { if constexpr (std::numeric_limits::is_signed) { return x == -std::numeric_limits::infinity() || x == std::numeric_limits::infinity(); } else { return x == std::numeric_limits::infinity(); } @@ -33,7 +33,7 @@ namespace ccm * @return True if the number is infinite, false otherwise. */ template , bool> = true> - inline constexpr bool isinf(Integer /* x */) noexcept + constexpr bool isinf(Integer /* x */) noexcept { return false; // Integers cannot be infinite } diff --git a/include/ccmath/math/compare/isless.hpp b/include/ccmath/math/compare/isless.hpp index d21c06ba..646d44ca 100644 --- a/include/ccmath/math/compare/isless.hpp +++ b/include/ccmath/math/compare/isless.hpp @@ -20,7 +20,7 @@ namespace ccm * @return true if the first argument is less than the second, false otherwise. */ template - inline constexpr bool isless(T x, T y) noexcept + constexpr bool isless(T x, T y) noexcept { return x < y; } @@ -34,7 +34,7 @@ namespace ccm * @return true if the first argument is less than the second, false otherwise. */ template - inline constexpr bool isless(T x, U y) noexcept + constexpr bool isless(T x, U y) noexcept { // Find the common type of the two arguments using shared_type = std::common_type_t; diff --git a/include/ccmath/math/compare/islessequal.hpp b/include/ccmath/math/compare/islessequal.hpp index 5b43b780..d8ff3480 100644 --- a/include/ccmath/math/compare/islessequal.hpp +++ b/include/ccmath/math/compare/islessequal.hpp @@ -20,7 +20,7 @@ namespace ccm * @return true if the first argument is less than or equal to the second, false otherwise. */ template - inline constexpr bool islessequal(T x, T y) noexcept + constexpr bool islessequal(T x, T y) noexcept { return x <= y; } @@ -34,7 +34,7 @@ namespace ccm * @return true if the first argument is less than or equal to the second, false otherwise. */ template - inline constexpr bool islessequal(T x, U y) noexcept + constexpr bool islessequal(T x, U y) noexcept { // Find the common type of the two arguments using shared_type = std::common_type_t; diff --git a/include/ccmath/math/compare/islessgreater.hpp b/include/ccmath/math/compare/islessgreater.hpp index 34b0ab32..b7528a41 100644 --- a/include/ccmath/math/compare/islessgreater.hpp +++ b/include/ccmath/math/compare/islessgreater.hpp @@ -20,7 +20,7 @@ namespace ccm * @return true if the first argument is less than the second or greater than the second, false otherwise. */ template - inline constexpr bool islessgreater(T x, T y) noexcept + constexpr bool islessgreater(T x, T y) noexcept { return x < y || x > y; } @@ -34,7 +34,7 @@ namespace ccm * @return true if the first argument is less than the second or greater than the second, false otherwise. */ template - inline constexpr bool islessgreater(T x, U y) noexcept + constexpr bool islessgreater(T x, U y) noexcept { using shared_type = std::common_type_t; return static_cast(islessgreater(static_cast(x), static_cast(y))); diff --git a/include/ccmath/math/compare/isnan.hpp b/include/ccmath/math/compare/isnan.hpp index 8d29f42c..4394cfee 100644 --- a/include/ccmath/math/compare/isnan.hpp +++ b/include/ccmath/math/compare/isnan.hpp @@ -19,7 +19,7 @@ namespace ccm * @return True if the number is NaN, false otherwise. */ template , int> = 0> - [[nodiscard]] inline constexpr bool isnan(T x) noexcept + [[nodiscard]] constexpr bool isnan(T x) noexcept { #if defined(__GNUC__) || defined(__clang__) return __builtin_isnan(x); // GCC and Clang implement this as constexpr @@ -34,7 +34,7 @@ namespace ccm * @return False, as integers can never be NaN. */ template , int> = 0> - [[nodiscard]] inline constexpr bool isnan(Integer /* x */) + [[nodiscard]] constexpr bool isnan(Integer /* x */) { return false; // Integers can never be NaN. } diff --git a/include/ccmath/math/compare/isnormal.hpp b/include/ccmath/math/compare/isnormal.hpp index f139127f..fd1e6ee0 100644 --- a/include/ccmath/math/compare/isnormal.hpp +++ b/include/ccmath/math/compare/isnormal.hpp @@ -21,7 +21,7 @@ namespace ccm * @return true if the number has a normal value, false otherwise. */ template , bool> = true> - inline constexpr bool isnormal(T num) noexcept + constexpr bool isnormal(T num) noexcept { return num != static_cast(0) && !ccm::isnan(num) && !ccm::isinf(num) && ccm::abs(num) >= std::numeric_limits::min(); } @@ -33,7 +33,7 @@ namespace ccm * @return true if the number has a normal value, false otherwise. */ template , bool> = true> - inline constexpr bool isnormal(Integer num) noexcept + constexpr bool isnormal(Integer num) noexcept { return num != static_cast(0); } diff --git a/include/ccmath/math/compare/isunordered.hpp b/include/ccmath/math/compare/isunordered.hpp index b33c99a9..1d3c5983 100644 --- a/include/ccmath/math/compare/isunordered.hpp +++ b/include/ccmath/math/compare/isunordered.hpp @@ -21,7 +21,7 @@ namespace ccm * @return true if either x or y is NaN, false otherwise. */ template , bool> = true> - inline constexpr bool isunordered(T x, T y) noexcept + constexpr bool isunordered(T x, T y) noexcept { return ccm::isnan(x) || ccm::isnan(y); } @@ -34,7 +34,7 @@ namespace ccm * @return false, as all integers are ordered. */ template , bool> = true> - inline constexpr bool isunordered(Integer /* x */, Integer /* y */) noexcept + constexpr bool isunordered(Integer /* x */, Integer /* y */) noexcept { return false; // All integers are ordered } @@ -48,7 +48,7 @@ namespace ccm * @return true if either x or y is NaN, false otherwise. */ template - inline constexpr bool isunordered(T x, U y) noexcept + constexpr bool isunordered(T x, U y) noexcept { using shared_type = std::common_type_t; return static_cast(isunordered(static_cast(x), static_cast(y))); diff --git a/include/ccmath/math/compare/signbit.hpp b/include/ccmath/math/compare/signbit.hpp index 3a0c577c..2219bc0a 100644 --- a/include/ccmath/math/compare/signbit.hpp +++ b/include/ccmath/math/compare/signbit.hpp @@ -65,7 +65,7 @@ namespace ccm * the dev team and we will try to bring support to your compiler ASAP if we are able to! */ template , int> = 0> - [[nodiscard]] inline constexpr bool signbit(T x) noexcept + [[nodiscard]] constexpr bool signbit(T x) noexcept { #if defined(CCMATH_HAS_CONSTEXPR_BUILTIN_SIGNBIT) return __builtin_signbit(x); @@ -107,7 +107,7 @@ namespace ccm * @note This function is constexpr and will return the same values as std::signbit along with being static_assert-able. */ template && std::is_signed_v, int> = 0> - [[nodiscard]] inline constexpr bool signbit(Integer x) noexcept + [[nodiscard]] constexpr bool signbit(Integer x) noexcept { // There is no concept of -0 for integers. So we can just check if the number is less than 0. return x < 0; @@ -122,7 +122,7 @@ namespace ccm * @note This function is constexpr and will return the same values as std::signbit along with being static_assert-able. */ template && !std::is_signed_v, int> = 0> - [[nodiscard]] inline constexpr bool signbit(Integer /* unused */) noexcept + [[nodiscard]] constexpr bool signbit(Integer /* unused */) noexcept { // If the number is unsigned, then it can't be negative. return false;