mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-09 06:31:47 +08:00
Alignment fixes:
* Fix AlignedBit computation for Plain Objects * use it for the conditional alignment of operator new * only overload new in PlainObjectBase, don't overload again in Matrix and Array
This commit is contained in:
parent
9ed342a30e
commit
a52ab9c089
@ -68,10 +68,8 @@ class Array
|
|||||||
friend struct internal::conservative_resize_like_impl;
|
friend struct internal::conservative_resize_like_impl;
|
||||||
|
|
||||||
using Base::m_storage;
|
using Base::m_storage;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { NeedsToAlign = (!(Options&DontAlign))
|
|
||||||
&& SizeAtCompileTime!=Dynamic && ((static_cast<int>(sizeof(Scalar))*SizeAtCompileTime)%16)==0 };
|
|
||||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
|
|
||||||
|
|
||||||
using Base::base;
|
using Base::base;
|
||||||
using Base::coeff;
|
using Base::coeff;
|
||||||
|
@ -153,10 +153,6 @@ class Matrix
|
|||||||
|
|
||||||
typedef typename Base::PlainObject PlainObject;
|
typedef typename Base::PlainObject PlainObject;
|
||||||
|
|
||||||
enum { NeedsToAlign = (!(Options&DontAlign))
|
|
||||||
&& SizeAtCompileTime!=Dynamic && ((static_cast<int>(sizeof(Scalar))*SizeAtCompileTime)%16)==0 };
|
|
||||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
|
|
||||||
|
|
||||||
using Base::base;
|
using Base::base;
|
||||||
using Base::coeffRef;
|
using Base::coeffRef;
|
||||||
|
|
||||||
|
@ -97,14 +97,12 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
|||||||
template<typename StrideType> struct StridedConstMapType { typedef Eigen::Map<const Derived, Unaligned, StrideType> type; };
|
template<typename StrideType> struct StridedConstMapType { typedef Eigen::Map<const Derived, Unaligned, StrideType> type; };
|
||||||
template<typename StrideType> struct StridedAlignedMapType { typedef Eigen::Map<Derived, Aligned, StrideType> type; };
|
template<typename StrideType> struct StridedAlignedMapType { typedef Eigen::Map<Derived, Aligned, StrideType> type; };
|
||||||
template<typename StrideType> struct StridedConstAlignedMapType { typedef Eigen::Map<const Derived, Aligned, StrideType> type; };
|
template<typename StrideType> struct StridedConstAlignedMapType { typedef Eigen::Map<const Derived, Aligned, StrideType> type; };
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
|
DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { NeedsToAlign = (!(Options&DontAlign))
|
enum { NeedsToAlign = SizeAtCompileTime != Dynamic && (internal::traits<Derived>::Flags & AlignedBit) != 0 };
|
||||||
&& SizeAtCompileTime!=Dynamic && ((static_cast<int>(sizeof(Scalar))*SizeAtCompileTime)%16)==0 };
|
|
||||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
|
||||||
|
|
||||||
Base& base() { return *static_cast<Base*>(this); }
|
Base& base() { return *static_cast<Base*>(this); }
|
||||||
|
@ -125,10 +125,9 @@ class compute_matrix_flags
|
|||||||
aligned_bit =
|
aligned_bit =
|
||||||
(
|
(
|
||||||
((Options&DontAlign)==0)
|
((Options&DontAlign)==0)
|
||||||
&& packet_traits<Scalar>::Vectorizable
|
|
||||||
&& (
|
&& (
|
||||||
#if EIGEN_ALIGN_STATICALLY
|
#if EIGEN_ALIGN_STATICALLY
|
||||||
((!is_dynamic_size_storage) && (((MaxCols*MaxRows) % packet_traits<Scalar>::size) == 0))
|
((!is_dynamic_size_storage) && (((MaxCols*MaxRows*sizeof(Scalar)) % 16) == 0))
|
||||||
#else
|
#else
|
||||||
0
|
0
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user