From d6586fa1fcb89bf50dd371e921a152a93c6d8a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 4 Nov 2013 17:15:01 +0100 Subject: [PATCH] Math: reduce code duplication in Functions.h. --- src/Math/Functions.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Math/Functions.h b/src/Math/Functions.h index 5ba6dd1be..1cdb809fb 100644 --- a/src/Math/Functions.h +++ b/src/Math/Functions.h @@ -242,10 +242,7 @@ template inline typename std::enable_if::value, T return T(1)/std::sqrt(a); } template Vector sqrtInverted(const Vector& a) { - Vector out; - for(std::size_t i = 0; i != size; ++i) - out[i] = T(1)/std::sqrt(a[i]); - return out; + return Vector(T(1))/sqrt(a); } #endif @@ -265,7 +262,7 @@ template inline typename std::enable_if::value, T template Vector clamp(const Vector& value, T min, T max) { Vector out; for(std::size_t i = 0; i != size; ++i) - out[i] = std::min(std::max(value[i], min), max); + out[i] = clamp(value[i], min, max); return out; } #endif