From eaa81c135a06788b758633b952a7d095f7bd80bc Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 21 Jun 2010 21:07:53 -0400 Subject: [PATCH] fix brain dead computation of the aligned bit. When using a max-size that is fixed and not a multiple of 16 bit, we're not aligned. --- Eigen/src/Core/util/XprHelper.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index c22d46a52..ff0426eb4 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -96,8 +96,12 @@ class ei_compute_matrix_flags row_major_bit = Options&RowMajor ? RowMajorBit : 0, inner_max_size = row_major_bit ? MaxCols : MaxRows, is_big = inner_max_size == Dynamic, - is_packet_size_multiple = (Cols*Rows) % ei_packet_traits::size == 0, - aligned_bit = ((Options&AutoAlign) && (is_big || is_packet_size_multiple)) ? AlignedBit : 0, + storage_has_fixed_size = MaxRows != Dynamic && MaxCols != Dynamic, + storage_has_aligned_fixed_size = storage_has_fixed_size + && ( (MaxCols*MaxRows) % ei_packet_traits::size == 0 ), + aligned_bit = ( (Options&AutoAlign) + && (is_big || storage_has_aligned_fixed_size) + ) ? AlignedBit : 0, packet_access_bit = ei_packet_traits::size > 1 && aligned_bit ? PacketAccessBit : 0 };