From 2afdef6a54e7fd09a4a6d5e933cf15ffa129beb6 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 6 Aug 2015 17:52:01 +0200 Subject: Generalize first_aligned to take the requested alignment as a template parameter, and add a first_default_aligned variante calling first_aligned with the requirement of the largest packet for the given scalar type. --- Eigen/src/Core/Redux.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Eigen/src/Core/Redux.h') diff --git a/Eigen/src/Core/Redux.h b/Eigen/src/Core/Redux.h index 0c25223aa..fa308b53e 100644 --- a/Eigen/src/Core/Redux.h +++ b/Eigen/src/Core/Redux.h @@ -221,12 +221,13 @@ struct redux_impl { const Index size = mat.size(); - const Index packetSize = packet_traits::size; - const Index alignedStart = internal::first_aligned(mat.nestedExpression()); + const Index packetSize = packet_traits::size; + const int packetBytes = int(packetSize*sizeof(Scalar)); enum { - alignment0 = (bool(Derived::Flags & DirectAccessBit) && bool(packet_traits::AlignedOnScalar)) ? int(sizeof(Scalar)*packetSize) : int(Unaligned), // FIXME take into account alignment requirement + alignment0 = (bool(Derived::Flags & DirectAccessBit) && bool(packet_traits::AlignedOnScalar)) ? int(packetBytes) : int(Unaligned), // FIXME take into account alignment requirement alignment = EIGEN_PLAIN_ENUM_MAX(alignment0, Derived::Alignment) }; + const Index alignedStart = internal::first_default_aligned(mat.nestedExpression()); const Index alignedSize2 = ((size-alignedStart)/(2*packetSize))*(2*packetSize); const Index alignedSize = ((size-alignedStart)/(packetSize))*(packetSize); const Index alignedEnd2 = alignedStart + alignedSize2; -- cgit v1.2.3