Changing to >= and <= as it's a slight optimization

This commit is contained in:
Jacob Kiesel 2017-02-07 09:52:23 -07:00
parent 28633b7e6d
commit 07ff5b62b9
1 changed files with 2 additions and 2 deletions

View File

@ -112,7 +112,7 @@ pub mod rational {
pub fn clamp<T: PartialOrd + Copy>(input: T, min: T, max: T) -> T {
debug_assert!(min < max, "min must be less than max");
if input < min {min}
else if input > max {max}
if input <= min {min}
else if input >= max {max}
else {input}
}