maths: make limit constexpr
This commit is contained in:
parent
c2770a266b
commit
03efa074ab
@ -350,13 +350,10 @@ namespace util {
|
|||||||
|
|
||||||
// min/max clamping
|
// min/max clamping
|
||||||
template <typename T, typename U, typename V>
|
template <typename T, typename U, typename V>
|
||||||
T
|
constexpr T
|
||||||
limit [[gnu::pure]] (const T val, const U lo, const V hi)
|
limit [[gnu::pure]] (const T val, const U lo, const V hi)
|
||||||
{
|
{
|
||||||
CHECK_LE(
|
CHECK_LE (lo, hi);
|
||||||
decltype (lo+hi) (lo),
|
|
||||||
decltype (hi+lo) (hi)
|
|
||||||
);
|
|
||||||
|
|
||||||
return val > hi ? hi:
|
return val > hi ? hi:
|
||||||
val < lo ? lo:
|
val < lo ? lo:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user