From 5fa694ffe1cd856177ccfb5ca75cc67d1db9dcec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Fri, 6 Jan 2023 21:59:14 +0100 Subject: [PATCH] Cleanup: BLI: Remove BLI_ENABLE_IF((is_math_float_type)) from vector API This was limiting the use of the templates with other non internal types. --- source/blender/blenlib/BLI_math_base.hh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/source/blender/blenlib/BLI_math_base.hh b/source/blender/blenlib/BLI_math_base.hh index d5279dfb3c5..098c53e43d2 100644 --- a/source/blender/blenlib/BLI_math_base.hh +++ b/source/blender/blenlib/BLI_math_base.hh @@ -59,13 +59,12 @@ template inline T clamp(const T &a, const T &min, const T &max) return std::clamp(a, min, max); } -template))> inline T mod(const T &a, const T &b) +template inline T mod(const T &a, const T &b) { return std::fmod(a, b); } -template))> -inline T safe_mod(const T &a, const T &b) +template inline T safe_mod(const T &a, const T &b) { return (b != 0) ? std::fmod(a, b) : 0; } @@ -76,18 +75,17 @@ template inline void min_max(const T &value, T &min, T &max) max = math::max(value, max); } -template))> -inline T safe_divide(const T &a, const T &b) +template inline T safe_divide(const T &a, const T &b) { return (b != 0) ? a / b : T(0.0f); } -template))> inline T floor(const T &a) +template inline T floor(const T &a) { return std::floor(a); } -template))> inline T ceil(const T &a) +template inline T ceil(const T &a) { return std::ceil(a); } @@ -97,7 +95,7 @@ template inline T distance(const T &a, const T &b) return std::abs(a - b); } -template))> inline T fract(const T &a) +template inline T fract(const T &a) { return a - std::floor(a); } @@ -147,10 +145,7 @@ template inline T hypot(const T &y, const T &x) return std::hypot(y, x); } -template)), - BLI_ENABLE_IF((is_math_float_type))> +template inline T interpolate(const T &a, const T &b, const FactorT &t) { auto result = a * (1 - t) + b * t;