From af983a3eef495e14a24c2063f743765d988d27d3 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 20 Jun 2022 16:22:04 +0200 Subject: BLI: add min_inplace and max_inplace functions --- source/blender/blenlib/BLI_math_base.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source') 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 inline T max(const T &a, const T &b) return std::max(a, b); } +template inline void max_inplace(T &a, const T &b) +{ + a = math::max(a, b); +} + +template inline void min_inplace(T &a, const T &b) +{ + a = math::min(a, b); +} + template inline T clamp(const T &a, const T &min, const T &max) { return std::clamp(a, min, max); -- cgit v1.2.3