diff --git a/include/Math.hpp b/include/Math.hpp index b952f67..c2de7fa 100644 --- a/include/Math.hpp +++ b/include/Math.hpp @@ -7,7 +7,7 @@ #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES 1 #endif -#include +#include #include #include "CVector3f.hpp" diff --git a/src/Math.cpp b/src/Math.cpp index 9145d3e..40161c5 100644 --- a/src/Math.cpp +++ b/src/Math.cpp @@ -46,8 +46,13 @@ double sqrtD(double val) } double q; #if __SSE__ - __m128d splat { val }; - q = _mm_sqrt_pd(splat)[0]; + union + { + __m128d v; + double d[2]; + } qv = { val }; + qv.v = _mm_sqrt_sd(qv.v, qv.v); + q = qv.d[0]; #else // le sigh, let's use Carmack's inverse square -.- union