simplification (no reason anymore to write that in that convoluted way)

This commit is contained in:
Benoit Jacob 2009-05-15 16:05:45 +00:00
parent 5ee9f1a705
commit dd390470e1

View File

@ -73,23 +73,21 @@ inline void* ei_aligned_malloc(size_t size)
ei_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)"); ei_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
#endif #endif
void *result; void *result;
#if EIGEN_HAS_POSIX_MEMALIGN && EIGEN_ALIGN && !EIGEN_MALLOC_ALREADY_ALIGNED #if !EIGEN_ALIGN
if(posix_memalign(&result, 16, size)) result = malloc(size);
result = 0; #elif EIGEN_MALLOC_ALREADY_ALIGNED
result = malloc(size);
#elif EIGEN_HAS_POSIX_MEMALIGN
if(posix_memalign(&result, 16, size)) result = 0;
#elif EIGEN_HAS_MM_MALLOC
result = _mm_malloc(size, 16);
#elif (defined _MSC_VER)
result = _aligned_malloc(size, 16);
#else #else
#if !EIGEN_ALIGN result = ei_handmade_aligned_malloc(size);
result = malloc(size);
#elif EIGEN_MALLOC_ALREADY_ALIGNED
result = malloc(size);
#elif EIGEN_HAS_MM_MALLOC
result = _mm_malloc(size, 16);
#elif (defined _MSC_VER)
result = _aligned_malloc(size, 16);
#else
result = ei_handmade_aligned_malloc(size);
#endif
#endif #endif
#ifdef EIGEN_EXCEPTIONS #ifdef EIGEN_EXCEPTIONS
if(result == 0) if(result == 0)
throw std::bad_alloc(); throw std::bad_alloc();