diff options
author | Hauke Heibel <hauke.heibel@gmail.com> | 2009-06-04 17:25:15 +0200 |
---|---|---|
committer | Hauke Heibel <hauke.heibel@gmail.com> | 2009-06-04 17:25:15 +0200 |
commit | f26c691678a7c6dd02789af3563a042e82677849 (patch) | |
tree | b04097c16f728e3cf35f9b4e7c379ee0f915af11 /Eigen | |
parent | 5f04f8eb6b934405c994c257dbe1e175fe0c9094 (diff) |
Renamed internal helper functions from the Memory header.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/util/Memory.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index d1d52d88d..cc3aa4fac 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -116,10 +116,10 @@ template<> inline void* ei_conditional_aligned_malloc<false>(size_t size) return result; } -/** \internal in-place allocate the elements of an array. +/** \internal construct the elements of an array. * The \a size parameter tells on how many objects to call the constructor of T. */ -template<typename T> inline T* ei_alloc_elements_of_array(T *ptr, size_t size) +template<typename T> inline T* ei_construct_elements_of_array(T *ptr, size_t size) { for (size_t i=0; i < size; ++i) ::new (ptr + i) T; return ptr; @@ -132,13 +132,13 @@ template<typename T> inline T* ei_alloc_elements_of_array(T *ptr, size_t size) template<typename T> inline T* ei_aligned_new(size_t size) { T *result = reinterpret_cast<T*>(ei_aligned_malloc(sizeof(T)*size)); - return ei_alloc_elements_of_array(result, size); + return ei_construct_elements_of_array(result, size); } template<typename T, bool Align> inline T* ei_conditional_aligned_new(size_t size) { T *result = reinterpret_cast<T*>(ei_conditional_aligned_malloc<Align>(sizeof(T)*size)); - return ei_alloc_elements_of_array(result, size); + return ei_construct_elements_of_array(result, size); } /** \internal free memory allocated with ei_aligned_malloc @@ -172,10 +172,10 @@ template<> inline void ei_conditional_aligned_free<false>(void *ptr) free(ptr); } -/** \internal delete the elements of an array. +/** \internal destruct the elements of an array. * The \a size parameters tells on how many objects to call the destructor of T. */ -template<typename T> inline void ei_delete_elements_of_array(T *ptr, size_t size) +template<typename T> inline void ei_destruct_elements_of_array(T *ptr, size_t size) { // always destruct an array starting from the end. while(size) ptr[--size].~T(); @@ -186,7 +186,7 @@ template<typename T> inline void ei_delete_elements_of_array(T *ptr, size_t size */ template<typename T> inline void ei_aligned_delete(T *ptr, size_t size) { - ei_delete_elements_of_array<T>(ptr, size); + ei_destruct_elements_of_array<T>(ptr, size); ei_aligned_free(ptr); } @@ -195,7 +195,7 @@ template<typename T> inline void ei_aligned_delete(T *ptr, size_t size) */ template<typename T, bool Align> inline void ei_conditional_aligned_delete(T *ptr, size_t size) { - ei_delete_elements_of_array<T>(ptr, size); + ei_destruct_elements_of_array<T>(ptr, size); ei_conditional_aligned_free<Align>(ptr); } @@ -234,8 +234,8 @@ inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset) #define ei_aligned_stack_free(PTR,SIZE) ei_aligned_free(PTR) #endif -#define ei_aligned_stack_new(TYPE,SIZE) ei_alloc_elements_of_array(reinterpret_cast<TYPE*>(ei_aligned_stack_alloc(sizeof(TYPE)*SIZE)), SIZE) -#define ei_aligned_stack_delete(TYPE,PTR,SIZE) do {ei_delete_elements_of_array<TYPE>(PTR, SIZE); \ +#define ei_aligned_stack_new(TYPE,SIZE) ei_construct_elements_of_array(reinterpret_cast<TYPE*>(ei_aligned_stack_alloc(sizeof(TYPE)*SIZE)), SIZE) +#define ei_aligned_stack_delete(TYPE,PTR,SIZE) do {ei_destruct_elements_of_array<TYPE>(PTR, SIZE); \ ei_aligned_stack_free(PTR,sizeof(TYPE)*SIZE);} while(0) |