aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Redux.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-08-06 17:52:01 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-08-06 17:52:01 +0200
commit2afdef6a54e7fd09a4a6d5e933cf15ffa129beb6 (patch)
tree796b23d51bcba9c17ade33b51b59d681979a8ba4 /Eigen/src/Core/Redux.h
parent1f5024332e47f295c991c3781d57d0466d41a9c8 (diff)
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.
Diffstat (limited to 'Eigen/src/Core/Redux.h')
-rw-r--r--Eigen/src/Core/Redux.h7
1 files changed, 4 insertions, 3 deletions
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<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
{
const Index size = mat.size();
- const Index packetSize = packet_traits<Scalar>::size;
- const Index alignedStart = internal::first_aligned(mat.nestedExpression());
+ const Index packetSize = packet_traits<Scalar>::size;
+ const int packetBytes = int(packetSize*sizeof(Scalar));
enum {
- alignment0 = (bool(Derived::Flags & DirectAccessBit) && bool(packet_traits<Scalar>::AlignedOnScalar)) ? int(sizeof(Scalar)*packetSize) : int(Unaligned), // FIXME take into account alignment requirement
+ alignment0 = (bool(Derived::Flags & DirectAccessBit) && bool(packet_traits<Scalar>::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;