mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 12:41:54 +00:00
Increase branch prediction on clamp function
This commit is contained in:
parent
8387847c42
commit
86328415fa
@ -729,9 +729,11 @@ namespace glm
|
|||||||
detail::type<valType>::is_int ||
|
detail::type<valType>::is_int ||
|
||||||
detail::type<valType>::is_uint, "'clamp' only accept numbers");
|
detail::type<valType>::is_uint, "'clamp' only accept numbers");
|
||||||
|
|
||||||
if(x >= maxVal) return maxVal;
|
// Old implementation, less predictable branching
|
||||||
if(x <= minVal) return minVal;
|
//if(x >= maxVal) return maxVal;
|
||||||
return x;
|
//if(x <= minVal) return minVal;
|
||||||
|
//return x;
|
||||||
|
return glm::max(glm::min(x, maxVal), minVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user