mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Removed ei_pload1, use posix_memalign to allocate aligned memory,
and make Product ok when only one side is vectorizable (and the product is still vectorized)
This commit is contained in:
@@ -54,7 +54,13 @@ T* ei_aligned_malloc(size_t size)
|
||||
{
|
||||
#ifdef EIGEN_VECTORIZE
|
||||
if (ei_packet_traits<T>::size>1)
|
||||
return static_cast<T*>(_mm_malloc(sizeof(T)*size, 16));
|
||||
{
|
||||
void* ptr;
|
||||
if (posix_memalign(&ptr, 16, size*sizeof(T))==0)
|
||||
return static_cast<T*>(ptr);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return new T[size];
|
||||
@@ -65,7 +71,7 @@ void ei_aligned_free(T* ptr)
|
||||
{
|
||||
#ifdef EIGEN_VECTORIZE
|
||||
if (ei_packet_traits<T>::size>1)
|
||||
_mm_free(ptr);
|
||||
free(ptr);
|
||||
else
|
||||
#endif
|
||||
delete[] ptr;
|
||||
|
||||
Reference in New Issue
Block a user