From 5a3ebda36b17f8de0efd0459515f4fa1050184ec Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Tue, 26 Nov 2019 16:18:29 -0800 Subject: [PATCH] Fix warning due to missing cast for exponent arguments for std::frexp and std::lexp. --- Eigen/src/Core/GenericPacketMath.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index d2c2027ff..8ffc684f2 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -244,14 +244,19 @@ pshiftleft(const long int& a) { return a << N; } /** \internal \returns the significant and exponent of the underlying floating point numbers * See https://en.cppreference.com/w/cpp/numeric/math/frexp */ -template EIGEN_DEVICE_FUNC inline Packet -pfrexp(const Packet &a, Packet &exponent) { return std::frexp(a,&exponent); } +template +EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) { + int exp; + Packet result = std::frexp(a, &exp); + exponent = static_cast(exp); + return result; +} /** \internal \returns a * 2^exponent * See https://en.cppreference.com/w/cpp/numeric/math/ldexp */ template EIGEN_DEVICE_FUNC inline Packet -pldexp(const Packet &a, const Packet &exponent) { return std::ldexp(a,exponent); } +pldexp(const Packet &a, const Packet &exponent) { return std::ldexp(a, static_cast(exponent)); } /** \internal \returns zeros */ template EIGEN_DEVICE_FUNC inline Packet @@ -259,7 +264,7 @@ pzero(const Packet& a) { return pxor(a,a); } template<> EIGEN_DEVICE_FUNC inline float pzero(const float& a) { EIGEN_UNUSED_VARIABLE(a); - return 0.; + return 0.f; } template<> EIGEN_DEVICE_FUNC inline double pzero(const double& a) {