Changing to >= and <= as it's a slight optimization
This commit is contained in:
parent
28633b7e6d
commit
07ff5b62b9
|
@ -112,7 +112,7 @@ pub mod rational {
|
||||||
|
|
||||||
pub fn clamp<T: PartialOrd + Copy>(input: T, min: T, max: T) -> T {
|
pub fn clamp<T: PartialOrd + Copy>(input: T, min: T, max: T) -> T {
|
||||||
debug_assert!(min < max, "min must be less than max");
|
debug_assert!(min < max, "min must be less than max");
|
||||||
if input < min {min}
|
if input <= min {min}
|
||||||
else if input > max {max}
|
else if input >= max {max}
|
||||||
else {input}
|
else {input}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue