* the 4th template param of Matrix is now Options. One bit for storage

order, one bit for enabling/disabling auto-alignment. If you want to
disable, do:
Matrix<float,4,1,Matrix_DontAlign>
The Matrix_ prefix is the only way I can see to avoid
ambiguity/pollution. The old RowMajor, ColMajor constants are
deprecated, remain for now.
* this prompted several improvements in matrix_storage. ei_aligned_array
renamed to ei_matrix_array and moved there. The %16==0 tests are now
much more centralized in 1 place there.
* unalignedassert test: updated
* update FindEigen2.cmake from KDElibs
* determinant test: use VERIFY_IS_APPROX to fix false positives; add
testing of 1 big matrix
This commit is contained in:
Benoit Jacob
2009-01-04 15:26:32 +00:00
parent d9e5fd393a
commit 15ca6659ac
11 changed files with 108 additions and 85 deletions

View File

@@ -67,6 +67,12 @@ struct Good8 : Eigen::WithAlignedOperatorNew
Matrix4f m;
};
struct Good9
{
Matrix<float,2,2,Matrix_DontAlign> m; // good: no alignment requested
float f;
};
template<typename T>
void check_unalignedassert_good()
{
@@ -80,7 +86,7 @@ void check_unalignedassert_good()
template<typename T>
void check_unalignedassert_bad()
{
float buf[1000];
float buf[sizeof(T)+16];
float *unaligned = buf;
while((reinterpret_cast<size_t>(unaligned)&0xf)==0) ++unaligned; // make sure unaligned is really unaligned
T *x = new(static_cast<void*>(unaligned)) T;
@@ -97,6 +103,7 @@ void unalignedassert()
VERIFY_RAISES_ASSERT(check_unalignedassert_bad<Bad6>());
check_unalignedassert_good<Good7>();
check_unalignedassert_good<Good8>();
check_unalignedassert_good<Good9>();
}
void test_unalignedassert()