diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index 46fa5c186..c655511f3 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -210,19 +210,19 @@ template inline Packet ei_preverse(const Packet& a) ***************************/ /** \internal \returns the sin of \a a (coeff-wise) */ -template inline static Packet ei_psin(Packet a) { return ei_sin(a); } +template inline static Packet ei_psin(const Packet& a) { return ei_sin(a); } /** \internal \returns the cos of \a a (coeff-wise) */ -template inline static Packet ei_pcos(Packet a) { return ei_cos(a); } +template inline static Packet ei_pcos(const Packet& a) { return ei_cos(a); } /** \internal \returns the exp of \a a (coeff-wise) */ -template inline static Packet ei_pexp(Packet a) { return ei_exp(a); } +template inline static Packet ei_pexp(const Packet& a) { return ei_exp(a); } /** \internal \returns the log of \a a (coeff-wise) */ -template inline static Packet ei_plog(Packet a) { return ei_log(a); } +template inline static Packet ei_plog(const Packet& a) { return ei_log(a); } /** \internal \returns the square-root of \a a (coeff-wise) */ -template inline static Packet ei_psqrt(Packet a) { return ei_sqrt(a); } +template inline static Packet ei_psqrt(const Packet& a) { return ei_sqrt(a); } /*************************************************************************** * The following functions might not have to be overwritten for vectorized types diff --git a/Eigen/src/Core/arch/SSE/MathFunctions.h b/Eigen/src/Core/arch/SSE/MathFunctions.h index 99662eb6d..79f9e39dd 100644 --- a/Eigen/src/Core/arch/SSE/MathFunctions.h +++ b/Eigen/src/Core/arch/SSE/MathFunctions.h @@ -30,8 +30,10 @@ #ifndef EIGEN_MATH_FUNCTIONS_SSE_H #define EIGEN_MATH_FUNCTIONS_SSE_H -static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_plog(Packet4f x) +template<> EIGEN_DONT_INLINE EIGEN_UNUSED +Packet4f ei_plog(const Packet4f& _x) { + Packet4f x = _x; _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f); _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f); _EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f); @@ -108,8 +110,10 @@ static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_plog(Packet4f x) return _mm_or_ps(x, invalid_mask); // negative arg will be NAN } -static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_pexp(Packet4f x) +template<> EIGEN_DONT_INLINE EIGEN_UNUSED +Packet4f ei_pexp(const Packet4f& _x) { + Packet4f x = _x; _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f); _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f); _EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f); @@ -181,8 +185,10 @@ static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_pexp(Packet4f x) surprising but correct result. */ -static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_psin(Packet4f x) +template<> EIGEN_DONT_INLINE EIGEN_UNUSED +Packet4f ei_psin(const Packet4f& _x) { + Packet4f x = _x; _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f); _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f); @@ -280,8 +286,10 @@ static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_psin(Packet4f x) } /* almost the same as ei_psin */ -static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_pcos(Packet4f x) +template<> EIGEN_DONT_INLINE EIGEN_UNUSED +Packet4f ei_pcos(const Packet4f& _x) { + Packet4f x = _x; _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f); _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f); @@ -367,7 +375,8 @@ static EIGEN_DONT_INLINE EIGEN_UNUSED Packet4f ei_pcos(Packet4f x) // This is Quake3's fast inverse square root. // For detail see here: http://www.beyond3d.com/content/articles/8/ -static EIGEN_UNUSED Packet4f ei_psqrt(Packet4f _x) +template<> EIGEN_UNUSED +Packet4f ei_psqrt(const Packet4f& _x) { Packet4f half = ei_pmul(_x, ei_pset1(.5f));