Browse Source

Fixed issue #18 glm::clamp and NaN's

Christophe Riccio 13 years ago
parent
commit
931b7bcdd6
1 changed files with 1 additions and 5 deletions
  1. 1 5
      glm/core/func_common.inl

+ 1 - 5
glm/core/func_common.inl

@@ -332,11 +332,7 @@ namespace detail
 			detail::type<valType>::is_int ||
 			detail::type<valType>::is_uint, "'clamp' only accept numbers");
 		
-		// Old implementation, less predictable branching
-		//if(x >= maxVal) return maxVal; 
-		//if(x <= minVal) return minVal;
-		//return x;
-		return max(min(x, maxVal), minVal);
+		return min(maxVal, max(minVal, x));
 	}
 
 	template <typename T>