after all we're not aligning to 8byte boundary

keep most of the changes though as they make the code more extensible
This commit is contained in:
Benoit Jacob 2009-10-05 10:55:42 -04:00
parent f01a8112d6
commit bb1cc0d092
3 changed files with 12 additions and 23 deletions

View File

@ -29,14 +29,12 @@
struct ei_constructor_without_unaligned_array_assert {}; struct ei_constructor_without_unaligned_array_assert {};
/** \internal /** \internal
* Static array. If the MatrixOptions require auto-alignment, and the array will be automatically aligned: * Static array. If the MatrixOptions require auto-alignment, the array will be automatically aligned:
* - to 16 bytes boundary, if the total size is a multiple of 16 bytes; * to 16 bytes boundary if the total size is a multiple of 16 bytes.
* - or else to 8 bytes boundary, if the total size is a multiple of 8 bytes.
*/ */
template <typename T, int Size, int MatrixOptions, template <typename T, int Size, int MatrixOptions,
int Alignment = (MatrixOptions&DontAlign) ? 0 int Alignment = (MatrixOptions&DontAlign) ? 0
: (((Size*sizeof(T))%16)==0) ? 16 : (((Size*sizeof(T))%16)==0) ? 16
: (((Size*sizeof(T))%8)==0) ? 8
: 0 > : 0 >
struct ei_matrix_array struct ei_matrix_array
{ {
@ -63,14 +61,6 @@ struct ei_matrix_array<T, Size, MatrixOptions, 16>
ei_matrix_array(ei_constructor_without_unaligned_array_assert) {} ei_matrix_array(ei_constructor_without_unaligned_array_assert) {}
}; };
template <typename T, int Size, int MatrixOptions>
struct ei_matrix_array<T, Size, MatrixOptions, 8>
{
EIGEN_ALIGN8 T array[Size];
ei_matrix_array() { EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0x7) }
ei_matrix_array(ei_constructor_without_unaligned_array_assert) {}
};
/** \internal /** \internal
* *
* \class ei_matrix_storage * \class ei_matrix_storage

View File

@ -223,7 +223,6 @@ using Eigen::ei_cos;
#endif #endif
#define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16) #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
#define EIGEN_ALIGN8 EIGEN_ALIGN_TO_BOUNDARY(8)
#ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
#define EIGEN_RESTRICT #define EIGEN_RESTRICT

View File

@ -93,7 +93,7 @@ void construct_at_boundary(int boundary)
void unalignedassert() void unalignedassert()
{ {
construct_at_boundary<Vector2f>(8); construct_at_boundary<Vector2f>(4);
construct_at_boundary<Vector3f>(4); construct_at_boundary<Vector3f>(4);
construct_at_boundary<Vector4f>(16); construct_at_boundary<Vector4f>(16);
construct_at_boundary<Matrix2f>(16); construct_at_boundary<Matrix2f>(16);
@ -101,12 +101,17 @@ void unalignedassert()
construct_at_boundary<Matrix4f>(16); construct_at_boundary<Matrix4f>(16);
construct_at_boundary<Vector2d>(16); construct_at_boundary<Vector2d>(16);
construct_at_boundary<Vector3d>(8); construct_at_boundary<Vector3d>(4);
construct_at_boundary<Vector4d>(16); construct_at_boundary<Vector4d>(16);
construct_at_boundary<Matrix2d>(16); construct_at_boundary<Matrix2d>(16);
construct_at_boundary<Matrix3d>(8); construct_at_boundary<Matrix3d>(4);
construct_at_boundary<Matrix4d>(16); construct_at_boundary<Matrix4d>(16);
construct_at_boundary<Vector2cf>(16);
construct_at_boundary<Vector3cf>(4);
construct_at_boundary<Vector2cd>(16);
construct_at_boundary<Vector3cd>(16);
check_unalignedassert_good<TestNew1>(); check_unalignedassert_good<TestNew1>();
check_unalignedassert_good<TestNew2>(); check_unalignedassert_good<TestNew2>();
check_unalignedassert_good<TestNew3>(); check_unalignedassert_good<TestNew3>();
@ -117,19 +122,14 @@ void unalignedassert()
check_unalignedassert_good<Depends<true> >(); check_unalignedassert_good<Depends<true> >();
#if EIGEN_ALIGN #if EIGEN_ALIGN
VERIFY_RAISES_ASSERT(construct_at_boundary<Vector2f>(4));
VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4f>(4));
VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4f>(8)); VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4f>(8));
VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix2f>(4));
VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix2f>(8));
VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix4f>(4));
VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix4f>(8)); VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix4f>(8));
VERIFY_RAISES_ASSERT(construct_at_boundary<Vector2d>(8)); VERIFY_RAISES_ASSERT(construct_at_boundary<Vector2d>(8));
VERIFY_RAISES_ASSERT(construct_at_boundary<Vector3d>(4));
VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4d>(8)); VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4d>(8));
VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix2d>(8)); VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix2d>(8));
VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix3d>(4));
VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix4d>(8)); VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix4d>(8));
VERIFY_RAISES_ASSERT(construct_at_boundary<Vector2cf>(8));
VERIFY_RAISES_ASSERT(construct_at_boundary<Vector2cd>(8));
#endif #endif
} }