From 3bbd1b3114e2afbac07e3f6c53be4ee7b203c67e Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 3 Sep 2008 14:42:36 +0000 Subject: [PATCH] Bugfix regarding alignent in Assign.h (updated map unit test to detect this bug) Anyway: LinearVectorization+CompleteUnrolling actually uses the InnerVectorization unrollers, so these two cases could be merged to a single one... --- Eigen/src/Core/Assign.h | 5 +++-- test/map.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h index 758858165..cdfd0b302 100644 --- a/Eigen/src/Core/Assign.h +++ b/Eigen/src/Core/Assign.h @@ -157,12 +157,13 @@ struct ei_assign_innervec_CompleteUnrolling : Index % Derived1::RowsAtCompileTime, col = int(Derived1::Flags)&RowMajorBit ? Index % int(Derived1::ColsAtCompileTime) - : Index / Derived1::RowsAtCompileTime + : Index / Derived1::RowsAtCompileTime, + SrcAlignment = ei_assign_traits::SrcAlignment }; inline static void run(Derived1 &dst, const Derived2 &src) { - dst.template copyPacket(row, col, src); + dst.template copyPacket(row, col, src); ei_assign_innervec_CompleteUnrolling::size, Stop>::run(dst, src); } diff --git a/test/map.cpp b/test/map.cpp index e7c1cf03d..705a74c3a 100644 --- a/test/map.cpp +++ b/test/map.cpp @@ -33,13 +33,21 @@ template void tmap(const VectorType& m) // test Map.h Scalar* array1 = ei_aligned_malloc(size); Scalar* array2 = ei_aligned_malloc(size); + Scalar* array3 = new Scalar[size+1]; + Scalar* array3unaligned = size_t(array3)%16 == 0 ? array3+1 : array3; + Map(array1, size) = VectorType::Random(size); Map(array2, size) = Map(array1, size); + Map(array3unaligned, size) = Map(array1, size); VectorType ma1 = Map(array1, size); VectorType ma2 = Map(array2, size); + VectorType ma3 = Map(array3unaligned, size); VERIFY_IS_APPROX(ma1, ma2); + VERIFY_IS_APPROX(ma1, ma3); + ei_aligned_free(array1); ei_aligned_free(array2); + delete[] array3; } void test_map()