mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +08:00
Add an explicit assersion on the alignment of the pointer returned by std::malloc
This commit is contained in:
parent
62a1c911cd
commit
e8e1d504d6
@ -157,6 +157,9 @@ EIGEN_DEVICE_FUNC inline void* aligned_malloc(size_t size)
|
|||||||
void *result;
|
void *result;
|
||||||
#if (EIGEN_DEFAULT_ALIGN_BYTES==0) || EIGEN_MALLOC_ALREADY_ALIGNED
|
#if (EIGEN_DEFAULT_ALIGN_BYTES==0) || EIGEN_MALLOC_ALREADY_ALIGNED
|
||||||
result = std::malloc(size);
|
result = std::malloc(size);
|
||||||
|
#if EIGEN_DEFAULT_ALIGN_BYTES==16
|
||||||
|
eigen_assert((size<16 || (std::size_t(result)%16)==0) && "System's malloc returned an unaligned pointer. Compile with EIGEN_MALLOC_ALREADY_ALIGNED=0 to fallback to handmade alignd memory allocator.");
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
result = handmade_aligned_malloc(size);
|
result = handmade_aligned_malloc(size);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user