diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-03 01:09:17 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-03 01:09:17 +0300 |
commit | 2600806c2ef1b626e3d82f14a7facfcc7f9f0992 (patch) | |
tree | a9af164290a83246e29f0dffd5217c5304ed21cd /source/blender/blenlib/BLI_math_vector.hh | |
parent | ecba8c1243045e72c92f4575393821fc6bf2665f (diff) |
Fix: BLI math clamp doesn't work
Return type was wrong, output of std::clamp wasn't used.
Diffstat (limited to 'source/blender/blenlib/BLI_math_vector.hh')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.hh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.hh b/source/blender/blenlib/BLI_math_vector.hh index 7c848eeb145..b1a3242ae52 100644 --- a/source/blender/blenlib/BLI_math_vector.hh +++ b/source/blender/blenlib/BLI_math_vector.hh @@ -79,13 +79,13 @@ inline vec_base<T, Size> max(const vec_base<T, Size> &a, const vec_base<T, Size> } template<typename T, int Size> -inline T clamp(const vec_base<T, Size> &a, - const vec_base<T, Size> &min, - const vec_base<T, Size> &max) +inline vec_base<T, Size> clamp(const vec_base<T, Size> &a, + const vec_base<T, Size> &min, + const vec_base<T, Size> &max) { vec_base<T, Size> result = a; for (int i = 0; i < Size; i++) { - std::clamp(result[i], min[i], max[i]); + result[i] = std::clamp(result[i], min[i], max[i]); } return result; } @@ -95,7 +95,7 @@ inline vec_base<T, Size> clamp(const vec_base<T, Size> &a, const T &min, const T { vec_base<T, Size> result = a; for (int i = 0; i < Size; i++) { - std::clamp(result[i], min, max); + result[i] = std::clamp(result[i], min, max); } return result; } |