Skip to content

Commit

Permalink
Remove redundant inline
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinzii committed Apr 6, 2024
1 parent 18ade36 commit 061b388
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 30 deletions.
12 changes: 6 additions & 6 deletions include/ccmath/math/compare/fpclassify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ namespace ccm
* @return The classification of the number as an integer
*/
template <typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
inline constexpr int fpclassify(T num)
constexpr int fpclassify(T num)
{
if (ccm::isnan(num)) { return static_cast<int>(ccm::helpers::floating_point_defines::eFP_NAN); }
if (ccm::isinf(num)) { return static_cast<int>(ccm::helpers::floating_point_defines::eFP_INFINITE); }
if (num == static_cast<T>(0)) { return static_cast<int>(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<T>(0)) { return ccm::helpers::floating_point_defines::eFP_ZERO; }
if (ccm::abs(num) < std::numeric_limits<T>::min() && ccm::abs(num) > 0)
{
return static_cast<int>(ccm::helpers::floating_point_defines::eFP_SUBNORMAL);
return ccm::helpers::floating_point_defines::eFP_SUBNORMAL;
}
return static_cast<int>(ccm::helpers::floating_point_defines::eFP_NORMAL);
return ccm::helpers::floating_point_defines::eFP_NORMAL;
}
} // namespace ccm
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/isfinite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace ccm
* @return true if the number has a finite value, false otherwise.
*/
template <typename T, std::enable_if_t<!std::is_integral_v<T>, bool> = true>
inline constexpr bool isfinite(T x)
constexpr bool isfinite(T x)
{
return (!ccm::isnan(x)) && (!ccm::isinf(x));
}
Expand All @@ -32,7 +32,7 @@ namespace ccm
* @return true if the number has a finite value, false otherwise.
*/
template <typename Integer, std::enable_if_t<std::is_integral_v<Integer>, bool> = true>
inline constexpr bool isfinite(Integer /* x */)
constexpr bool isfinite(Integer /* x */)
{
return false; // All integers are finite
}
Expand Down
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/isgreater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace ccm
* @return true if the first argument is greater than the second, false otherwise.
*/
template <typename T>
inline constexpr bool isgreater(T x, T y) noexcept
constexpr bool isgreater(T x, T y) noexcept
{
return x > y;
}
Expand All @@ -34,7 +34,7 @@ namespace ccm
* @return true if the first argument is greater than the second, false otherwise.
*/
template <typename T, typename U>
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<T, U>;
Expand Down
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/isgreaterequal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace ccm
* @return true if the first argument is greater than or equal to the second, false otherwise.
*/
template <typename T>
inline constexpr bool isgreaterequal(T x, T y) noexcept
constexpr bool isgreaterequal(T x, T y) noexcept
{
return x >= y;
}
Expand All @@ -34,7 +34,7 @@ namespace ccm
* @return true if the first argument is greater than or equal to the second, false otherwise.
*/
template <typename T, typename U>
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<T, U>;
Expand Down
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/isinf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace ccm
* @return True if the number is infinite, false otherwise.
*/
template <typename T, std::enable_if_t<!std::is_integral_v<T>, bool> = true>
inline constexpr bool isinf(T x) noexcept
constexpr bool isinf(T x) noexcept
{
if constexpr (std::numeric_limits<T>::is_signed) { return x == -std::numeric_limits<T>::infinity() || x == std::numeric_limits<T>::infinity(); }
else { return x == std::numeric_limits<T>::infinity(); }
Expand All @@ -33,7 +33,7 @@ namespace ccm
* @return True if the number is infinite, false otherwise.
*/
template <typename Integer, std::enable_if_t<std::is_integral_v<Integer>, bool> = true>
inline constexpr bool isinf(Integer /* x */) noexcept
constexpr bool isinf(Integer /* x */) noexcept
{
return false; // Integers cannot be infinite
}
Expand Down
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/isless.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace ccm
* @return true if the first argument is less than the second, false otherwise.
*/
template <typename T>
inline constexpr bool isless(T x, T y) noexcept
constexpr bool isless(T x, T y) noexcept
{
return x < y;
}
Expand All @@ -34,7 +34,7 @@ namespace ccm
* @return true if the first argument is less than the second, false otherwise.
*/
template <typename T, typename U>
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<T, U>;
Expand Down
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/islessequal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace ccm
* @return true if the first argument is less than or equal to the second, false otherwise.
*/
template <typename T>
inline constexpr bool islessequal(T x, T y) noexcept
constexpr bool islessequal(T x, T y) noexcept
{
return x <= y;
}
Expand All @@ -34,7 +34,7 @@ namespace ccm
* @return true if the first argument is less than or equal to the second, false otherwise.
*/
template <typename T, typename U>
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<T, U>;
Expand Down
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/islessgreater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T>
inline constexpr bool islessgreater(T x, T y) noexcept
constexpr bool islessgreater(T x, T y) noexcept
{
return x < y || x > y;
}
Expand All @@ -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 <typename T, typename U>
inline constexpr bool islessgreater(T x, U y) noexcept
constexpr bool islessgreater(T x, U y) noexcept
{
using shared_type = std::common_type_t<T, U>;
return static_cast<shared_type>(islessgreater<shared_type>(static_cast<shared_type>(x), static_cast<shared_type>(y)));
Expand Down
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/isnan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace ccm
* @return True if the number is NaN, false otherwise.
*/
template <typename T, std::enable_if_t<!std::is_integral_v<T>, 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
Expand All @@ -34,7 +34,7 @@ namespace ccm
* @return False, as integers can never be NaN.
*/
template <typename Integer, std::enable_if_t<std::is_integral_v<Integer>, int> = 0>
[[nodiscard]] inline constexpr bool isnan(Integer /* x */)
[[nodiscard]] constexpr bool isnan(Integer /* x */)
{
return false; // Integers can never be NaN.
}
Expand Down
4 changes: 2 additions & 2 deletions include/ccmath/math/compare/isnormal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace ccm
* @return true if the number has a normal value, false otherwise.
*/
template <typename T, std::enable_if_t<!std::is_integral_v<T>, bool> = true>
inline constexpr bool isnormal(T num) noexcept
constexpr bool isnormal(T num) noexcept
{
return num != static_cast<T>(0) && !ccm::isnan(num) && !ccm::isinf(num) && ccm::abs(num) >= std::numeric_limits<T>::min();
}
Expand All @@ -33,7 +33,7 @@ namespace ccm
* @return true if the number has a normal value, false otherwise.
*/
template <typename Integer, std::enable_if_t<std::is_integral_v<Integer>, bool> = true>
inline constexpr bool isnormal(Integer num) noexcept
constexpr bool isnormal(Integer num) noexcept
{
return num != static_cast<Integer>(0);
}
Expand Down
6 changes: 3 additions & 3 deletions include/ccmath/math/compare/isunordered.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace ccm
* @return true if either x or y is NaN, false otherwise.
*/
template <typename T, std::enable_if_t<!std::is_integral_v<T>, 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);
}
Expand All @@ -34,7 +34,7 @@ namespace ccm
* @return false, as all integers are ordered.
*/
template <typename Integer, std::enable_if_t<std::is_integral_v<Integer>, 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
}
Expand All @@ -48,7 +48,7 @@ namespace ccm
* @return true if either x or y is NaN, false otherwise.
*/
template <typename T, typename U>
inline constexpr bool isunordered(T x, U y) noexcept
constexpr bool isunordered(T x, U y) noexcept
{
using shared_type = std::common_type_t<T, U>;
return static_cast<shared_type>(isunordered<shared_type>(static_cast<shared_type>(x), static_cast<shared_type>(y)));
Expand Down
6 changes: 3 additions & 3 deletions include/ccmath/math/compare/signbit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T, std::enable_if_t<std::is_floating_point_v<T>, 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);
Expand Down Expand Up @@ -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 <typename Integer, std::enable_if_t<std::is_integral_v<Integer> && std::is_signed_v<Integer>, 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;
Expand All @@ -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 <typename Integer, std::enable_if_t<std::is_integral_v<Integer> && !std::is_signed_v<Integer>, 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;
Expand Down

0 comments on commit 061b388

Please sign in to comment.