[Bf-blender-cvs] [af983a3eef4] master: BLI: add min_inplace and max_inplace functions

Jacques Lucke noreply at git.blender.org
Mon Jun 20 16:28:12 CEST 2022


Commit: af983a3eef495e14a24c2063f743765d988d27d3
Author: Jacques Lucke
Date:   Mon Jun 20 16:22:04 2022 +0200
Branches: master
https://developer.blender.org/rBaf983a3eef495e14a24c2063f743765d988d27d3

BLI: add min_inplace and max_inplace functions

===================================================================

M	source/blender/blenlib/BLI_math_base.hh

===================================================================

diff --git a/source/blender/blenlib/BLI_math_base.hh b/source/blender/blenlib/BLI_math_base.hh
index 3057e30dc03..b15179f75b6 100644
--- a/source/blender/blenlib/BLI_math_base.hh
+++ b/source/blender/blenlib/BLI_math_base.hh
@@ -44,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);



More information about the Bf-blender-cvs mailing list