From 0dfc5b296be31a06a630ff389344a54b2be507ba Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 22 Jul 2010 13:16:53 +0200 Subject: [PATCH] fix strict aliasing issue --- Eigen/src/Core/arch/SSE/Complex.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h index 8c0fd9a7f..919ed2a05 100644 --- a/Eigen/src/Core/arch/SSE/Complex.h +++ b/Eigen/src/Core/arch/SSE/Complex.h @@ -109,12 +109,9 @@ template<> EIGEN_STRONG_INLINE Packet2cf ei_pset1(const std::complex< template<> EIGEN_STRONG_INLINE std::complex ei_pfirst(const Packet2cf& a) { - union { - float res[2]; - double asDouble; - }; - _mm_store_sd(&asDouble,_mm_castps_pd(a.v)); - return *(std::complex*)res; + std::complex res; + _mm_storel_pi((__m64*)&res, a.v); + return res; } template<> EIGEN_STRONG_INLINE Packet2cf ei_preverse(const Packet2cf& a) { return Packet2cf(_mm_castpd_ps(ei_preverse(_mm_castps_pd(a.v)))); }