From 72a5de232099fbca32d573a76349dbb51f7851ef Mon Sep 17 00:00:00 2001 From: Mathias Labeyrie Date: Wed, 5 Nov 2014 13:57:32 +0100 Subject: [PATCH] branchless wrapAngle --- glm/gtx/fast_trigonometry.inl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/glm/gtx/fast_trigonometry.inl b/glm/gtx/fast_trigonometry.inl index 632be5d2..b22487d5 100644 --- a/glm/gtx/fast_trigonometry.inl +++ b/glm/gtx/fast_trigonometry.inl @@ -9,12 +9,10 @@ namespace glm { - template + template GLM_FUNC_QUALIFIER T wrapAngle(T const & angle) { - T result = angle - floor(angle * one_over_two_pi()) * two_pi(); - result = result > T(0) ? result : -result; - return result; + return abs(mod(angle, two_pi())); } VECTORIZE_VEC(wrapAngle)