mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-15 05:05:58 +08:00
backport 126284d08bcf9abb3a6665bf31305a188371e461
.
This commit is contained in:
parent
841ec959e5
commit
990615e884
@ -238,6 +238,20 @@ inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset)
|
|||||||
|
|
||||||
|
|
||||||
#if EIGEN_ARCH_WANTS_ALIGNMENT
|
#if EIGEN_ARCH_WANTS_ALIGNMENT
|
||||||
|
#ifdef EIGEN_EXCEPTIONS
|
||||||
|
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \
|
||||||
|
void* operator new(size_t size, const std::nothrow_t&) throw() { \
|
||||||
|
try { return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); } \
|
||||||
|
catch (...) { return 0; } \
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \
|
||||||
|
void* operator new(size_t size, const std::nothrow_t&) throw() { \
|
||||||
|
return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) \
|
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) \
|
||||||
void *operator new(size_t size) { \
|
void *operator new(size_t size) { \
|
||||||
return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); \
|
return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); \
|
||||||
@ -253,11 +267,7 @@ inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset)
|
|||||||
static void *operator new(size_t size, void *ptr) { return ::operator new(size,ptr); } \
|
static void *operator new(size_t size, void *ptr) { return ::operator new(size,ptr); } \
|
||||||
void operator delete(void * memory, void *ptr) throw() { return ::operator delete(memory,ptr); } \
|
void operator delete(void * memory, void *ptr) throw() { return ::operator delete(memory,ptr); } \
|
||||||
/* nothrow-new (returns zero instead of std::bad_alloc) */ \
|
/* nothrow-new (returns zero instead of std::bad_alloc) */ \
|
||||||
void* operator new(size_t size, const std::nothrow_t&) throw() { \
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \
|
||||||
try { return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); } \
|
|
||||||
catch (...) { return 0; } \
|
|
||||||
return 0; \
|
|
||||||
} \
|
|
||||||
void operator delete(void *ptr, const std::nothrow_t&) throw() { \
|
void operator delete(void *ptr, const std::nothrow_t&) throw() { \
|
||||||
Eigen::ei_conditional_aligned_free<NeedsToAlign>(ptr); \
|
Eigen::ei_conditional_aligned_free<NeedsToAlign>(ptr); \
|
||||||
} \
|
} \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user