Let unpacket_traits<> exposes the required alignment and make use of it everywhere

This commit is contained in:
Gael Guennebaud
2015-08-07 10:44:01 +02:00
parent 2afdef6a54
commit ce57dbd937
18 changed files with 54 additions and 43 deletions

View File

@@ -553,7 +553,8 @@ inline Index first_aligned(const Scalar* array, Index size)
template<typename Scalar, typename Index>
inline Index first_default_aligned(const Scalar* array, Index size)
{
return first_aligned<packet_traits<Scalar>::size*sizeof(Scalar)>(array, size);
typedef typename packet_traits<Scalar>::type DefaultPacketType;
return first_aligned<unpacket_traits<DefaultPacketType>::alignment>(array, size);
}
/** \internal Returns the smallest integer multiple of \a base and greater or equal to \a size

View File

@@ -119,7 +119,11 @@ template<typename T> struct unpacket_traits
{
typedef T type;
typedef T half;
enum {size=1};
enum
{
size = 1,
alignment = 1
};
};
#if EIGEN_MAX_STATIC_ALIGN_BYTES>0