[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/eigen2/Eigen/src/Core
From:       BenoƮt Jacob <jacob.benoit.1 () gmail ! com>
Date:       2009-01-05 13:15:28
Message-ID: 1231161328.442131.21944.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 906058 by bjacob:

fix compilation on apple: _mm_malloc was undefined. the fix is to just use malloc \
since on apple it already returns aligned ptrs



 M  +1 -1      Matrix.h  
 M  +5 -1      util/Memory.h  


--- trunk/kdesupport/eigen2/Eigen/src/Core/Matrix.h #906057:906058
@@ -119,7 +119,7 @@
 
 template<typename T, int Rows, int Cols, int Options,
          bool NeedsToAlign = ((Options&Matrix_AutoAlign) == Matrix_AutoAlign) && \
                Rows!=Dynamic && Cols!=Dynamic && ((sizeof(T)*Rows*Cols)%16==0)>
-struct ei_matrix_with_aligned_operator_new : WithAlignedOperatorNew {};
+struct ei_matrix_with_aligned_operator_new : public WithAlignedOperatorNew {};
 
 template<typename T, int Rows, int Cols, int Options>
 struct ei_matrix_with_aligned_operator_new<T, Rows, Cols, Options, false> {};
--- trunk/kdesupport/eigen2/Eigen/src/Core/util/Memory.h #906057:906058
@@ -56,6 +56,8 @@
     #else
       #ifdef _MSC_VER
         void_result = _aligned_malloc(size*sizeof(T), 16);
+      #elif defined(__APPLE__)
+        void_result = malloc(size*sizeof(T)); // Apple's malloc() already returns \
aligned ptrs  #else
         void_result = _mm_malloc(size*sizeof(T), 16);
       #endif
@@ -71,7 +73,7 @@
     // and this type has a custom operator new, then we want to honor this operator \
                new!
     // so when we use C functions to allocate memory, we must be careful to call \
manually the constructor using  // the special placement-new syntax.
-    return new(void_result) T[size];    
+    return new(void_result) T[size];
   }
   else
     return new T[size]; // here we really want a new, not a malloc. Justification: \
if the user uses Eigen on @@ -95,6 +97,8 @@
       while(size) ptr[--size].~T();
       #if defined(__linux)
         free(ptr);
+      #elif defined(__APPLE__)
+        free(ptr);
       #elif defined(_MSC_VER)
         _aligned_free(ptr);
       #else


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic