aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unalignedassert.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-01-04 15:26:32 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-01-04 15:26:32 +0000
commit15ca6659acea545178116096bff3e42068b4f4cb (patch)
tree0f4093c77a3312b69dff071db7fd1ad14a3d6d25 /test/unalignedassert.cpp
parentd9e5fd393a48db368dd90cf7119ebb3d774111cb (diff)
* 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
Diffstat (limited to 'test/unalignedassert.cpp')
-rw-r--r--test/unalignedassert.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/unalignedassert.cpp b/test/unalignedassert.cpp
index 4f9495a51..0b5bf0c77 100644
--- a/test/unalignedassert.cpp
+++ b/test/unalignedassert.cpp
@@ -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()