mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-24 14:45:14 +08:00
use ei_aligned_malloc and ei_aligned_free also in WithAlignedOperatorNew, so this too should now work with MSVC.
This commit is contained in:
parent
9b1a3d6e19
commit
763f0a2434
@ -27,9 +27,11 @@
|
||||
#define EIGEN_MEMORY_H
|
||||
|
||||
#ifdef EIGEN_VECTORIZE
|
||||
#ifndef _MSC_VER
|
||||
// it seems we cannot assume posix_memalign is defined in the stdlib header
|
||||
extern "C" int posix_memalign (void **, size_t, size_t) throw ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** \internal
|
||||
* Static array automatically aligned if the total byte size is a multiple of 16
|
||||
@ -165,24 +167,16 @@ struct WithAlignedOperatorNew
|
||||
|
||||
void *operator new(size_t size) throw()
|
||||
{
|
||||
void* ptr = 0;
|
||||
if (posix_memalign(&ptr, 16, size)==0)
|
||||
return ptr;
|
||||
else
|
||||
return 0;
|
||||
return ei_aligned_malloc<char>(size);
|
||||
}
|
||||
|
||||
void *operator new[](size_t size) throw()
|
||||
{
|
||||
void* ptr = 0;
|
||||
if (posix_memalign(&ptr, 16, size)==0)
|
||||
return ptr;
|
||||
else
|
||||
return 0;
|
||||
return ei_aligned_malloc<char>(size);
|
||||
}
|
||||
|
||||
void operator delete(void * ptr) { free(ptr); }
|
||||
void operator delete[](void * ptr) { free(ptr); }
|
||||
void operator delete(void * ptr) { ei_aligned_free(static_cast<char *>(ptr)); }
|
||||
void operator delete[](void * ptr) { ei_aligned_free(static_cast<char *>(ptr)); }
|
||||
|
||||
#endif
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user