From edff639204ebe69238d49b21e25449c157c006d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 20 Oct 2018 14:45:04 +0200 Subject: [PATCH] Math: functions were not inline by mistake. It's inline for all others of similar size, so why not this. --- src/Magnum/Math/Functions.h | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Magnum/Math/Functions.h b/src/Magnum/Math/Functions.h index a50b0cade..d8e3862a7 100644 --- a/src/Magnum/Math/Functions.h +++ b/src/Magnum/Math/Functions.h @@ -91,7 +91,7 @@ UnsignedInt MAGNUM_EXPORT log2(UnsignedInt number); Returns natural (base @f$ e @f$) logarithm of given number. @see @ref Constants::e(), @ref log(UnsignedInt, UnsignedInt), @ref log2() */ -template T log(T number) { return std::log(number); } +template inline T log(T number) { return std::log(number); } /** @brief Natural exponential @@ -99,7 +99,7 @@ template T log(T number) { return std::log(number); } Returns @f$ e^x @f$. @see @ref Constants::e(), @ref pow(T, T) */ -template T exp(T exponent) { return std::exp(exponent); } +template inline T exp(T exponent) { return std::exp(exponent); } /** @brief Integer division with remainder @@ -118,7 +118,7 @@ Int quotient = 57/6; Int remainder = 57%6; @endcode */ -template std::pair div(Integral x, Integral y) { +template inline std::pair div(Integral x, Integral y) { static_assert(std::is_integral{}, "Math::div(): not an integral type"); const auto result = std::div(x, y); return {result.quot, result.rem}; @@ -220,7 +220,7 @@ template constexpr T pow(T base); template constexpr typename std::enable_if::value, T>::type pow(T base) { return Implementation::Pow::pow(base); } -template Vector pow(const Vector& base) { +template inline Vector pow(const Vector& base) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = Implementation::Pow::pow(base[i]); @@ -237,7 +237,7 @@ Returns power of @p base to the @p exponent. #ifdef DOXYGEN_GENERATING_OUTPUT template T pow(T base, T exponent); #else -template typename std::enable_if::value, T>::type pow(T base, T exponent) { +template inline typename std::enable_if::value, T>::type pow(T base, T exponent) { return std::pow(base, exponent); } template inline Vector pow(const Vector& base, T exponent) { @@ -281,7 +281,7 @@ template inline Vector min(const Vector T min(Corrade::Containers::ArrayView range) { +template inline T min(Corrade::Containers::ArrayView range) { if(range.empty()) return {}; T out(range[0]); @@ -321,7 +321,7 @@ template Vector max(const Vector& v #endif /** @overload */ -template Vector max(const Vector& value, T max) { +template inline Vector max(const Vector& value, T max) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = std::max(value[i], max); @@ -333,7 +333,7 @@ template Vector max(const Vector& v If the range is empty, returns default-constructed value. */ -template T max(Corrade::Containers::ArrayView range) { +template inline T max(Corrade::Containers::ArrayView range) { if(range.empty()) return {}; T out(range[0]); @@ -364,7 +364,7 @@ template inline std::pair minmax(const T& a, const T& b); template inline typename std::enable_if::value, std::pair>::type minmax(T a, T b) { return a < b ? std::make_pair(a, b) : std::make_pair(b, a); } -template std::pair, Vector> minmax(const Vector& a, const Vector& b) { +template inline std::pair, Vector> minmax(const Vector& a, const Vector& b) { using std::swap; std::pair, Vector> out{a, b}; for(std::size_t i = 0; i != size; ++i) @@ -392,7 +392,7 @@ namespace Implementation { If the range is empty, returns default-constructed values. @see @ref Range::Range(const std::pair&) */ -template std::pair minmax(Corrade::Containers::ArrayView range) { +template inline std::pair minmax(Corrade::Containers::ArrayView range) { if(range.empty()) return {}; T min{range[0]}, max{range[0]}; @@ -431,7 +431,7 @@ template inline T clamp(const T& value, const T& min, const T& template inline typename std::enable_if::value, T>::type clamp(T value, T min, T max) { return std::min(std::max(value, min), max); } -template Vector clamp(const Vector& value, const Vector& min, const Vector& max) { +template inline Vector clamp(const Vector& value, const Vector& min, const Vector& max) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = clamp(value[i], min[i], max[i]); @@ -440,7 +440,7 @@ template Vector clamp(const Vector& #endif /** @overload */ -template Vector clamp(const Vector& value, T min, T max) { +template inline Vector clamp(const Vector& value, T min, T max) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = clamp(value[i], min, max); @@ -460,7 +460,7 @@ template inline typename std::enable_if::value, T if(scalar < T(0)) return T(-1); return T(0); } -template Vector sign(const Vector& a) { +template inline Vector sign(const Vector& a) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = sign(a[i]); @@ -475,7 +475,7 @@ template inline T abs(const T& a); template inline typename std::enable_if::value, T>::type abs(T a) { return std::abs(a); } -template Vector abs(const Vector& a) { +template inline Vector abs(const Vector& a) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = std::abs(a[i]); @@ -490,7 +490,7 @@ template inline T floor(const T& a); template inline typename std::enable_if::value, T>::type floor(T a) { return std::floor(a); } -template Vector floor(const Vector& a) { +template inline Vector floor(const Vector& a) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = std::floor(a[i]); @@ -505,7 +505,7 @@ template inline T round(const T& a); template inline typename std::enable_if::value, T>::type round(T a) { return std::round(a); } -template Vector round(const Vector& a) { +template inline Vector round(const Vector& a) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = std::round(a[i]); @@ -520,7 +520,7 @@ template inline T ceil(const T& a); template inline typename std::enable_if::value, T>::type ceil(T a) { return std::ceil(a); } -template Vector ceil(const Vector& a) { +template inline Vector ceil(const Vector& a) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = std::ceil(a[i]); @@ -539,7 +539,7 @@ template inline T sqrt(const T& a); template inline typename std::enable_if::value, T>::type sqrt(T a) { return T(std::sqrt(a)); } -template Vector sqrt(const Vector& a) { +template inline Vector sqrt(const Vector& a) { Vector out{NoInit}; for(std::size_t i = 0; i != size; ++i) out[i] = T(std::sqrt(a[i])); @@ -559,7 +559,7 @@ template inline T sqrtInverted(const T& a); template inline typename std::enable_if::value, T>::type sqrtInverted(T a) { return T(1)/std::sqrt(a); } -template Vector sqrtInverted(const Vector& a) { +template inline Vector sqrtInverted(const Vector& a) { return Vector(T(1))/sqrt(a); } #endif