mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-18 10:54:26 +08:00
aligned-on-scalar assertion was still too aggressive: it now takes into account the sizes at runtime
This commit is contained in:
parent
62b08cf9f9
commit
37ed0d991a
@ -174,14 +174,16 @@ template<typename PlainObjectType, int MapOptions, typename StrideType> class Ma
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static void checkPointer(const Scalar* dataPtr)
|
void checkPointer(const Scalar* dataPtr)
|
||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
MightTryToAlignOnScalar = internal::packet_traits<Scalar>::AlignedOnScalar
|
MightTryToAlignOnScalar = internal::packet_traits<Scalar>::AlignedOnScalar
|
||||||
&& bool(internal::traits<Map>::Flags&PacketAccessBit)
|
&& bool(internal::traits<Map>::Flags&PacketAccessBit)
|
||||||
&& internal::is_lvalue<Map>::value
|
&& internal::is_lvalue<Map>::value,
|
||||||
|
PacketSize = internal::packet_traits<Scalar>::size
|
||||||
};
|
};
|
||||||
eigen_assert(EIGEN_IMPLIES(bool(MightTryToAlignOnScalar), (size_t(dataPtr) % sizeof(Scalar)) == 0)
|
Index linear_size = bool(internal::traits<Map>::Flags&LinearAccessBit) ? this->size() : this->innerSize();
|
||||||
|
eigen_assert(EIGEN_IMPLIES(bool(MightTryToAlignOnScalar) && (linear_size>=PacketSize), (size_t(dataPtr) % sizeof(Scalar)) == 0)
|
||||||
&& "input pointer is not aligned on scalar boundary, e.g., use \"EIGEN_ALIGN8 T ptr[N];\" for double or complex<float>");
|
&& "input pointer is not aligned on scalar boundary, e.g., use \"EIGEN_ALIGN8 T ptr[N];\" for double or complex<float>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user