diff options
Diffstat (limited to 'source/blender/blenlib/BLI_math_base.hh')
-rw-r--r-- | source/blender/blenlib/BLI_math_base.hh | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/blenlib/BLI_math_base.hh b/source/blender/blenlib/BLI_math_base.hh index 034c6968c94..b15179f75b6 100644 --- a/source/blender/blenlib/BLI_math_base.hh +++ b/source/blender/blenlib/BLI_math_base.hh @@ -14,19 +14,9 @@ #include "BLI_math_base_safe.h" #include "BLI_utildefines.h" -#ifdef WITH_GMP -# include "BLI_math_mpq.hh" -#endif - namespace blender::math { -template<typename T> -inline constexpr bool is_math_float_type = (std::is_floating_point_v<T> -#ifdef WITH_GMP - || std::is_same_v<T, mpq_class> -#endif -); - +template<typename T> inline constexpr bool is_math_float_type = std::is_floating_point_v<T>; template<typename T> inline constexpr bool is_math_integral_type = std::is_integral_v<T>; template<typename T> inline bool is_zero(const T &a) @@ -54,6 +44,16 @@ template<typename T> inline T max(const T &a, const T &b) return std::max(a, b); } +template<typename T> inline void max_inplace(T &a, const T &b) +{ + a = math::max(a, b); +} + +template<typename T> inline void min_inplace(T &a, const T &b) +{ + a = math::min(a, b); +} + template<typename T> inline T clamp(const T &a, const T &min, const T &max) { return std::clamp(a, min, max); |