diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index 4020c556..9ac12ef5 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -729,9 +729,11 @@ namespace glm detail::type::is_int || detail::type::is_uint, "'clamp' only accept numbers"); - if(x >= maxVal) return maxVal; - if(x <= minVal) return minVal; - return x; + // Old implementation, less predictable branching + //if(x >= maxVal) return maxVal; + //if(x <= minVal) return minVal; + //return x; + return glm::max(glm::min(x, maxVal), minVal); } template