From 74ff5719b3e177aa0e342a117421fd1f304cbb99 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Mon, 28 Sep 2020 22:47:11 +0000 Subject: Fix compilation of 64 bit constant arguments to pset1frombits in TypeCasting.h on platforms where uint64_t != unsigned long. --- Eigen/src/Core/arch/SSE/TypeCasting.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Eigen/src/Core/arch/SSE') diff --git a/Eigen/src/Core/arch/SSE/TypeCasting.h b/Eigen/src/Core/arch/SSE/TypeCasting.h index 708385f1a..bb68986c2 100644 --- a/Eigen/src/Core/arch/SSE/TypeCasting.h +++ b/Eigen/src/Core/arch/SSE/TypeCasting.h @@ -108,13 +108,13 @@ EIGEN_STRONG_INLINE Packet2d pcast(const Packet2l& a) { // The idea is to convert upper and lower half separately, via bit-twiddling // then add them together, but remove the offsets Packet2d upper = preinterpret(plogical_shift_right<32>(a)); - Packet2d lower = pand(pset1frombits(0xffffffffUL), preinterpret(a)); + Packet2d lower = pand(pset1frombits(static_cast(0xffffffffULL)), preinterpret(a)); // upper = 2**(53+32) + ((a >> 32) + 0x80000000) - upper = pxor(pset1frombits(0x4530000080000000UL), upper); // exponent of 52+32, and xor the upper bit of 32bit mantissa + upper = pxor(pset1frombits(static_cast(0x4530000080000000ULL)), upper); // exponent of 52+32, and xor the upper bit of 32bit mantissa // lower = 2**53 + (a & 0xffffffff) - lower = pxor(pset1frombits(0x4330000000000000UL), lower); // exponent of 52 + lower = pxor(pset1frombits(static_cast(0x4330000000000000ULL)), lower); // exponent of 52 // adding upper+lower would be 2**84+2**63+2**52 too big. Create the negative of that: - Packet2d offset = pset1frombits(0xC530000080100000UL); + Packet2d offset = pset1frombits(static_cast(0xC530000080100000ULL)); // add everything together, start with the bigger numbers, since the 2**84 will cancel out, giving an exact result return padd(padd(offset, upper), lower); #endif -- cgit v1.2.3