diff --git a/src/core/include/mp-units/bits/constexpr_math.h b/src/core/include/mp-units/bits/constexpr_math.h index fd88b9e5..8dc66aa5 100644 --- a/src/core/include/mp-units/bits/constexpr_math.h +++ b/src/core/include/mp-units/bits/constexpr_math.h @@ -39,6 +39,12 @@ import std; namespace mp_units::detail { +template +[[nodiscard]] MP_UNITS_CONSTEVAL T abs(T v) noexcept +{ + return v < 0 ? -v : v; +} + // Raise an arbitrary arithmetic type to a positive integer power at compile time. template [[nodiscard]] consteval T int_power(T base, std::integral auto exp) diff --git a/src/core/include/mp-units/bits/ratio.h b/src/core/include/mp-units/bits/ratio.h index 329f5106..4a06147c 100644 --- a/src/core/include/mp-units/bits/ratio.h +++ b/src/core/include/mp-units/bits/ratio.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -39,12 +40,6 @@ import std; namespace mp_units::detail { -template -[[nodiscard]] MP_UNITS_CONSTEVAL T abs(T v) noexcept -{ - return v < 0 ? -v : v; -} - [[nodiscard]] consteval std::intmax_t safe_multiply(std::intmax_t lhs, std::intmax_t rhs) { constexpr std::intmax_t c = std::uintmax_t{1} << (sizeof(std::intmax_t) * 4);