aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-12-07 16:31:32 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-12-07 16:31:32 +0000
commit08e6b7ad808b981a286984fcc30476c853b434fc (patch)
tree9877056566da200ba6b71fab680f94cc9ff7f155 /Eigen/src
parent7e8ee5b527e32caa2920615f40dd4cbe96fe7b50 (diff)
Make deluxe assertion with deluxe error message with link to deluxe web page
for this very nasty bug (unaligned member in dynamically allocated struct) that our friends at Krita just encountered: http://bugs.kde.org/show_bug.cgi?id=177133 CCBUG:177133
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Core/util/Memory.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
index b73b1ebf9..c1dea2bb4 100644
--- a/Eigen/src/Core/util/Memory.h
+++ b/Eigen/src/Core/util/Memory.h
@@ -37,6 +37,17 @@ extern "C" int posix_memalign (void **, size_t, size_t) throw ();
template <typename T, int Size, bool Align> struct ei_aligned_array
{
EIGEN_ALIGN_128 T array[Size];
+
+ ei_aligned_array()
+ {
+ ei_assert(reinterpret_cast<unsigned int>(array)%16 == 0
+ && "An array that should have been aligned was allocated at a non-aligned location! "
+ "Basically, if a struct Foo has a member that's a fixed-size vectorizable Eigen object (like "
+ "a Eigen::Vector2d) and you dynamically allocate objects of struct Foo, then you need to "
+ "let struct Foo have an aligned operator new, which you can do like this: "
+ "struct Foo : Eigen::WithAlignedOperatorNew {... "
+ "See this page for details: http://eigen.tuxfamily.org/api/UnalignedArrayAssert.html");
+ }
};
template <typename T, int Size> struct ei_aligned_array<T,Size,false>