The ABI break:

* set AutoAlign=0, DontAlign!=0
* set Dynamic=33331
* add check on fixed sizes
* bump version to 2.0.52
This commit is contained in:
Benoit Jacob 2009-03-26 16:30:54 +00:00
parent ce5669dbf9
commit 1b7b538e05
4 changed files with 12 additions and 9 deletions

View File

@ -134,7 +134,7 @@ class Matrix
ei_matrix_storage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime, Options> m_storage; ei_matrix_storage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime, Options> m_storage;
public: public:
enum { NeedsToAlign = (Options&AutoAlign) == AutoAlign enum { NeedsToAlign = (!(Options&DontAlign))
&& SizeAtCompileTime!=Dynamic && ((sizeof(Scalar)*SizeAtCompileTime)%16)==0 }; && SizeAtCompileTime!=Dynamic && ((sizeof(Scalar)*SizeAtCompileTime)%16)==0 };
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
@ -536,7 +536,8 @@ class Matrix
{ {
EIGEN_STATIC_ASSERT(((_MaxRows >= _Rows || _Rows==Dynamic) EIGEN_STATIC_ASSERT(((_MaxRows >= _Rows || _Rows==Dynamic)
&& (_MaxCols >= _Cols || _Cols==Dynamic) && (_MaxCols >= _Cols || _Cols==Dynamic)
&& (_Options & (AutoAlign|RowMajor)) == _Options), && ((_MaxRows==Dynamic?1:_MaxRows)*(_MaxCols==Dynamic?1:_MaxCols)<Dynamic)
&& (_Options & (DontAlign|RowMajor)) == _Options),
INVALID_MATRIX_TEMPLATE_PARAMETERS) INVALID_MATRIX_TEMPLATE_PARAMETERS)
} }
}; };

View File

@ -32,7 +32,7 @@ struct ei_constructor_without_unaligned_array_assert {};
* Static array automatically aligned if the total byte size is a multiple of 16 and the matrix options require auto alignment * Static array automatically aligned if the total byte size is a multiple of 16 and the matrix options require auto alignment
*/ */
template <typename T, int Size, int MatrixOptions, template <typename T, int Size, int MatrixOptions,
bool Align = (MatrixOptions&AutoAlign) && (((Size*sizeof(T))&0xf)==0) bool Align = (!(MatrixOptions&DontAlign)) && (((Size*sizeof(T))&0xf)==0)
> struct ei_matrix_array > struct ei_matrix_array
{ {
EIGEN_ALIGN_128 T array[Size]; EIGEN_ALIGN_128 T array[Size];

View File

@ -30,17 +30,19 @@
* stored in some runtime variable. * stored in some runtime variable.
* *
* Explanation for the choice of this value: * Explanation for the choice of this value:
* - It should be positive and larger than any reasonable compile-time-fixed number of rows or columns. * - It should be positive and larger than the number of entries in any reasonable fixed-size matrix.
* This allows to simplify many compile-time conditions throughout Eigen. * This allows to simplify many compile-time conditions throughout Eigen.
* - It should be smaller than the sqrt of INT_MAX. Indeed, we often multiply a number of rows with a number * - It should be smaller than the sqrt of INT_MAX. Indeed, we often multiply a number of rows with a number
* of columns in order to compute a number of coefficients. Even if we guard that with an "if" checking whether * of columns in order to compute a number of coefficients. Even if we guard that with an "if" checking whether
* the values are Dynamic, we still get a compiler warning "integer overflow". So the only way to get around * the values are Dynamic, we still get a compiler warning "integer overflow". So the only way to get around
* it would be a meta-selector. Doing this everywhere would reduce code readability and lenghten compilation times. * it would be a meta-selector. Doing this everywhere would reduce code readability and lenghten compilation times.
* Also, disabling compiler warnings for integer overflow, sounds like a bad idea. * Also, disabling compiler warnings for integer overflow, sounds like a bad idea.
* - It should be a prime number, because for example the old value 10000 led to bugs with 100x100 matrices.
* *
* If you wish to port Eigen to a platform where sizeof(int)==2, it is perfectly possible to set Dynamic to, say, 100. * If you wish to port Eigen to a platform where sizeof(int)==2, it is perfectly possible to set Dynamic to, say, 97.
* However, changing the value of Dynamic breaks the ABI, as Dynamic is often used as a template parameter for Matrix.
*/ */
const int Dynamic = 10000; const int Dynamic = 33331;
/** This value means +Infinity; it is currently used only as the p parameter to MatrixBase::lpNorm<int>(). /** This value means +Infinity; it is currently used only as the p parameter to MatrixBase::lpNorm<int>().
* The value Infinity there means the L-infinity norm. * The value Infinity there means the L-infinity norm.
@ -227,9 +229,9 @@ enum {
RowMajor = 0x1, // it is only a coincidence that this is equal to RowMajorBit -- don't rely on that RowMajor = 0x1, // it is only a coincidence that this is equal to RowMajorBit -- don't rely on that
/** \internal Don't require alignment for the matrix itself (the array of coefficients, if dynamically allocated, may still be /** \internal Don't require alignment for the matrix itself (the array of coefficients, if dynamically allocated, may still be
requested to be aligned) */ requested to be aligned) */
DontAlign = 0,
/** \internal Align the matrix itself if it is vectorizable fixed-size */ /** \internal Align the matrix itself if it is vectorizable fixed-size */
AutoAlign = 0x2 AutoAlign = 0,
DontAlign = 0x2
}; };
enum { enum {

View File

@ -30,7 +30,7 @@
#define EIGEN_WORLD_VERSION 2 #define EIGEN_WORLD_VERSION 2
#define EIGEN_MAJOR_VERSION 0 #define EIGEN_MAJOR_VERSION 0
#define EIGEN_MINOR_VERSION 51 #define EIGEN_MINOR_VERSION 52
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \ #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \ (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \