math: support max of three values additional to min and use it everywhere

This commit is contained in:
Matthias Grob
2021-12-07 21:06:51 +01:00
parent e8676fe87a
commit 68e2940f58
12 changed files with 18 additions and 12 deletions
+6
View File
@@ -68,6 +68,12 @@ constexpr _Tp max(_Tp a, _Tp b)
return (a > b) ? a : b;
}
template<typename _Tp>
constexpr _Tp max(_Tp a, _Tp b, _Tp c)
{
return max(max(a, b), c);
}
template<typename _Tp>
constexpr _Tp constrain(_Tp val, _Tp min_val, _Tp max_val)
{