aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-05-15 16:05:45 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-05-15 16:05:45 +0000
commitdd390470e1deac4c765129a27fc8738c467f0f62 (patch)
tree677de6548d7440e4511b8ad309c618e1c6346185 /Eigen/src
parent5ee9f1a705934b0e2e6619da9cb127100476157e (diff)
simplification (no reason anymore to write that in that convoluted way)
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Core/util/Memory.h28
1 files changed, 13 insertions, 15 deletions
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
index 95693e076..1d516e388 100644
--- a/Eigen/src/Core/util/Memory.h
+++ b/Eigen/src/Core/util/Memory.h
@@ -73,23 +73,21 @@ inline void* ei_aligned_malloc(size_t size)
ei_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
#endif
- void *result;
- #if EIGEN_HAS_POSIX_MEMALIGN && EIGEN_ALIGN && !EIGEN_MALLOC_ALREADY_ALIGNED
- if(posix_memalign(&result, 16, size))
- result = 0;
+ void *result;
+ #if !EIGEN_ALIGN
+ result = malloc(size);
+ #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
- #if !EIGEN_ALIGN
- 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
+ result = ei_handmade_aligned_malloc(size);
#endif
+
#ifdef EIGEN_EXCEPTIONS
if(result == 0)
throw std::bad_alloc();