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

@ -74,14 +74,12 @@ inline void* ei_aligned_malloc(size_t size)
#endif #endif
void *result; void *result;
#if EIGEN_HAS_POSIX_MEMALIGN && EIGEN_ALIGN && !EIGEN_MALLOC_ALREADY_ALIGNED
if(posix_memalign(&result, 16, size))
result = 0;
#else
#if !EIGEN_ALIGN #if !EIGEN_ALIGN
result = malloc(size); result = malloc(size);
#elif EIGEN_MALLOC_ALREADY_ALIGNED #elif EIGEN_MALLOC_ALREADY_ALIGNED
result = malloc(size); result = malloc(size);
#elif EIGEN_HAS_POSIX_MEMALIGN
if(posix_memalign(&result, 16, size)) result = 0;
#elif EIGEN_HAS_MM_MALLOC #elif EIGEN_HAS_MM_MALLOC
result = _mm_malloc(size, 16); result = _mm_malloc(size, 16);
#elif (defined _MSC_VER) #elif (defined _MSC_VER)
@ -89,7 +87,7 @@ inline void* ei_aligned_malloc(size_t size)
#else #else
result = ei_handmade_aligned_malloc(size); 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();