From 9b1a3d6e192c80887e97cd2574edcda577a81095 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 15 Dec 2008 17:33:19 +0000 Subject: [PATCH] small optimization (for MSVC) and simplification of ei_alligned_malloc --- Eigen/src/Core/util/Memory.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 9e6ec71c1..682494c97 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -57,15 +57,15 @@ inline T* ei_aligned_malloc(size_t size) #ifdef EIGEN_VECTORIZE if(ei_packet_traits::size>1) { - void* ptr; #ifdef _MSC_VER - if(ptr = _aligned_malloc(size*sizeof(T), 16)) + return static_cast(_aligned_malloc(size*sizeof(T), 16)); #else - if(posix_memalign(&ptr, 16, size*sizeof(T))==0) + void* ptr; + if(posix_memalign(&ptr, 16, size*sizeof(T))==0) + return static_cast(ptr); + else + return 0; #endif - return static_cast(ptr); - else - return 0; } else #endif