mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-07 13:41:54 +08:00
fix bug #267: alloca is not aligned on arm
This commit is contained in:
parent
d4fd298fbb
commit
179d42bb2b
@ -529,10 +529,16 @@ template<typename T> class aligned_stack_memory_handler
|
|||||||
*/
|
*/
|
||||||
#ifdef EIGEN_ALLOCA
|
#ifdef EIGEN_ALLOCA
|
||||||
|
|
||||||
|
#ifdef __arm__
|
||||||
|
#define EIGEN_ALIGNED_ALLOCA(SIZE) reinterpret_cast<void*>((reinterpret_cast<size_t>(EIGEN_ALLOCA(SIZE+16)) & ~(size_t(15))) + 16)
|
||||||
|
#else
|
||||||
|
#define EIGEN_ALIGNED_ALLOCA EIGEN_ALLOCA
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ei_declare_aligned_stack_constructed_variable(TYPE,NAME,SIZE,BUFFER) \
|
#define ei_declare_aligned_stack_constructed_variable(TYPE,NAME,SIZE,BUFFER) \
|
||||||
TYPE* NAME = (BUFFER)!=0 ? (BUFFER) \
|
TYPE* NAME = (BUFFER)!=0 ? (BUFFER) \
|
||||||
: reinterpret_cast<TYPE*>( \
|
: reinterpret_cast<TYPE*>( \
|
||||||
(sizeof(TYPE)*SIZE<=EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALLOCA(sizeof(TYPE)*SIZE) \
|
(sizeof(TYPE)*SIZE<=EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(TYPE)*SIZE) \
|
||||||
: Eigen::internal::aligned_malloc(sizeof(TYPE)*SIZE) ); \
|
: Eigen::internal::aligned_malloc(sizeof(TYPE)*SIZE) ); \
|
||||||
Eigen::internal::aligned_stack_memory_handler<TYPE> EIGEN_CAT(NAME,_stack_memory_destructor)((BUFFER)==0 ? NAME : 0,SIZE,sizeof(TYPE)*SIZE>EIGEN_STACK_ALLOCATION_LIMIT)
|
Eigen::internal::aligned_stack_memory_handler<TYPE> EIGEN_CAT(NAME,_stack_memory_destructor)((BUFFER)==0 ? NAME : 0,SIZE,sizeof(TYPE)*SIZE>EIGEN_STACK_ALLOCATION_LIMIT)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user