Limits the value pointer points to into [low, high], in place. Unlike a clamp that returns a value, this edits the variable. With low > high the value ends at high. A NaN is left as it is, because every comparison with it is false.
x := 15;
Clamp(*x, 0, 10);
assert(x == 10);Clamp :: (pointer: *$T, low: T, high: T)
Limits the value behind pointer to low..high, in place.
Parameters
- pointer: *$T
- the value to limit.
- low: T
- the smallest value allowed.
- high: T
- the largest value allowed.