diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-08-06 15:31:07 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-08-06 15:31:07 +0200 |
commit | 1f5024332e47f295c991c3781d57d0466d41a9c8 (patch) | |
tree | 154fa01d41076ca58bdbff8c3bb0850119df92fa /test/mapped_matrix.cpp | |
parent | 65186ef18d6212b3d09b1d619f1cf1019c2ae0fb (diff) |
First part of a big refactoring of alignment control to enable the handling of arbitrarily aligned buffers. It includes:
- AlignedBit flag is deprecated. Alignment is now specified by the evaluator through the 'Alignment' enum, e.g., evaluator<Xpr>::Alignment. Its value is in Bytes.
- Add several enums to specify alignment: Aligned8, Aligned16, Aligned32, Aligned64, Aligned128. AlignedMax corresponds to EIGEN_MAX_ALIGN_BYTES. Such enums are used to define the above Alignment value, and as the 'Options' template parameter of Map<> and Ref<>.
- The Aligned enum is now deprecated. It is now an alias for Aligned16.
- Currently, traits<Matrix<>>, traits<Array<>>, traits<Ref<>>, traits<Map<>>, and traits<Block<>> also expose the Alignment enum.
Diffstat (limited to 'test/mapped_matrix.cpp')
-rw-r--r-- | test/mapped_matrix.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/mapped_matrix.cpp b/test/mapped_matrix.cpp index f080ca7ed..7c7099792 100644 --- a/test/mapped_matrix.cpp +++ b/test/mapped_matrix.cpp @@ -25,15 +25,15 @@ template<typename VectorType> void map_class_vector(const VectorType& m) Scalar* array1 = internal::aligned_new<Scalar>(size); Scalar* array2 = internal::aligned_new<Scalar>(size); Scalar* array3 = new Scalar[size+1]; - Scalar* array3unaligned = size_t(array3)%EIGEN_MAX_ALIGN_BYTES == 0 ? array3+1 : array3; + Scalar* array3unaligned = (std::size_t(array3)%EIGEN_MAX_ALIGN_BYTES) == 0 ? array3+1 : array3; Scalar array4[EIGEN_TESTMAP_MAX_SIZE]; - Map<VectorType, Aligned>(array1, size) = VectorType::Random(size); - Map<VectorType, Aligned>(array2, size) = Map<VectorType,Aligned>(array1, size); + Map<VectorType, AlignedMax>(array1, size) = VectorType::Random(size); + Map<VectorType, AlignedMax>(array2, size) = Map<VectorType,AlignedMax>(array1, size); Map<VectorType>(array3unaligned, size) = Map<VectorType>(array1, size); - Map<VectorType>(array4, size) = Map<VectorType,Aligned>(array1, size); - VectorType ma1 = Map<VectorType, Aligned>(array1, size); - VectorType ma2 = Map<VectorType, Aligned>(array2, size); + Map<VectorType>(array4, size) = Map<VectorType,AlignedMax>(array1, size); + VectorType ma1 = Map<VectorType, AlignedMax>(array1, size); + VectorType ma2 = Map<VectorType, AlignedMax>(array2, size); VectorType ma3 = Map<VectorType>(array3unaligned, size); VectorType ma4 = Map<VectorType>(array4, size); VERIFY_IS_EQUAL(ma1, ma2); @@ -41,7 +41,7 @@ template<typename VectorType> void map_class_vector(const VectorType& m) VERIFY_IS_EQUAL(ma1, ma4); #ifdef EIGEN_VECTORIZE if(internal::packet_traits<Scalar>::Vectorizable) - VERIFY_RAISES_ASSERT((Map<VectorType,Aligned>(array3unaligned, size))) + VERIFY_RAISES_ASSERT((Map<VectorType,AlignedMax>(array3unaligned, size))) #endif internal::aligned_delete(array1, size); @@ -71,7 +71,7 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& m) for(int i = 0; i < size; i++) array4[i] = Scalar(1); Map<MatrixType> map1(array1, rows, cols); - Map<MatrixType, Aligned> map2(array2, rows, cols); + Map<MatrixType, AlignedMax> map2(array2, rows, cols); Map<MatrixType> map3(array3unaligned, rows, cols); Map<MatrixType> map4(array4, rows, cols); @@ -154,9 +154,9 @@ template<typename PlainObjectType> void check_const_correctness(const PlainObjec // verify that map-to-const don't have LvalueBit typedef typename internal::add_const<PlainObjectType>::type ConstPlainObjectType; VERIFY( !(internal::traits<Map<ConstPlainObjectType> >::Flags & LvalueBit) ); - VERIFY( !(internal::traits<Map<ConstPlainObjectType, Aligned> >::Flags & LvalueBit) ); + VERIFY( !(internal::traits<Map<ConstPlainObjectType, AlignedMax> >::Flags & LvalueBit) ); VERIFY( !(Map<ConstPlainObjectType>::Flags & LvalueBit) ); - VERIFY( !(Map<ConstPlainObjectType, Aligned>::Flags & LvalueBit) ); + VERIFY( !(Map<ConstPlainObjectType, AlignedMax>::Flags & LvalueBit) ); } template<typename Scalar> |