aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2018-11-27 23:45:00 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2018-11-27 23:45:00 +0100
commitb131a4db2439ea1ca4ba86cbc86aa962914915c5 (patch)
tree9252ae5948715f0afbd08a5faf072ded72013c14 /Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
parenta1a5fbbd212fb962d2bcc1533ae09037ee4177a1 (diff)
bug #1631: fix compilation with ARM NEON and clang, and cleanup the weird pshiftright_and_cast and pcast_and_shiftleft functions.
Diffstat (limited to 'Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h')
-rw-r--r--Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
index 067d1dbe0..465f9bc3e 100644
--- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
+++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
@@ -16,6 +16,26 @@
namespace Eigen {
namespace internal {
+template<typename Packet> EIGEN_STRONG_INLINE Packet
+pfrexp_float(const Packet& a, Packet& exponent) {
+ typedef typename unpacket_traits<Packet>::integer_packet PacketI;
+ const Packet cst_126f = pset1<Packet>(126.0f);
+ const Packet cst_half = pset1<Packet>(0.5f);
+ const Packet cst_inv_mant_mask = pset1frombits<Packet>(~0x7f800000u);
+ exponent = psub(pcast<PacketI,Packet>(pshiftright<23>(preinterpret<PacketI>(a))), cst_126f);
+ return por(pand(a, cst_inv_mant_mask), cst_half);
+}
+
+template<typename Packet> EIGEN_STRONG_INLINE Packet
+pldexp_float(Packet a, Packet exponent)
+{
+ typedef typename unpacket_traits<Packet>::integer_packet PacketI;
+ const Packet cst_127 = pset1<Packet>(127.f);
+ // return a * 2^exponent
+ PacketI ei = pcast<Packet,PacketI>(padd(exponent, cst_127));
+ return pmul(a, preinterpret<Packet>(pshiftleft<23>(ei)));
+}
+
// Natural logarithm
// Computes log(x) as log(2^e * m) = C*e + log(m), where the constant C =log(2)
// and m is in the range [sqrt(1/2),sqrt(2)). In this range, the logarithm can