diff --git a/Eigen/src/Core/CacheFriendlyProduct.h b/Eigen/src/Core/CacheFriendlyProduct.h index 40c6984dc..767d93f86 100644 --- a/Eigen/src/Core/CacheFriendlyProduct.h +++ b/Eigen/src/Core/CacheFriendlyProduct.h @@ -172,7 +172,7 @@ static void ei_cache_friendly_product( for(int l1j=l2j; l1j((reinterpret_cast(original) & ~(size_t(15))) + 16); + void *aligned = reinterpret_cast((reinterpret_cast(original) & ~(std::size_t(15))) + 16); *(reinterpret_cast(aligned) - 1) = original; return aligned; } @@ -77,7 +77,7 @@ inline void ei_handmade_aligned_free(void *ptr) /** \internal allocates \a size bytes. The returned pointer is guaranteed to have 16 bytes alignment. * On allocation error, the returned pointer is null, and if exceptions are enabled then a std::bad_alloc is thrown. */ -inline void* ei_aligned_malloc(size_t size) +inline void* ei_aligned_malloc(std::size_t size) { #ifdef EIGEN_NO_MALLOC ei_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)"); @@ -108,12 +108,12 @@ inline void* ei_aligned_malloc(size_t size) /** allocates \a size bytes. If Align is true, then the returned ptr is 16-byte-aligned. * On allocation error, the returned pointer is null, and if exceptions are enabled then a std::bad_alloc is thrown. */ -template inline void* ei_conditional_aligned_malloc(size_t size) +template inline void* ei_conditional_aligned_malloc(std::size_t size) { return ei_aligned_malloc(size); } -template<> inline void* ei_conditional_aligned_malloc(size_t size) +template<> inline void* ei_conditional_aligned_malloc(std::size_t size) { #ifdef EIGEN_NO_MALLOC ei_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)"); @@ -129,9 +129,9 @@ template<> inline void* ei_conditional_aligned_malloc(size_t size) /** \internal construct the elements of an array. * The \a size parameter tells on how many objects to call the constructor of T. */ -template inline T* ei_construct_elements_of_array(T *ptr, size_t size) +template inline T* ei_construct_elements_of_array(T *ptr, std::size_t size) { - for (size_t i=0; i < size; ++i) ::new (ptr + i) T; + for (std::size_t i=0; i < size; ++i) ::new (ptr + i) T; return ptr; } @@ -139,13 +139,13 @@ template inline T* ei_construct_elements_of_array(T *ptr, size_t siz * On allocation error, the returned pointer is undefined, but if exceptions are enabled then a std::bad_alloc is thrown. * The default constructor of T is called. */ -template inline T* ei_aligned_new(size_t size) +template inline T* ei_aligned_new(std::size_t size) { T *result = reinterpret_cast(ei_aligned_malloc(sizeof(T)*size)); return ei_construct_elements_of_array(result, size); } -template inline T* ei_conditional_aligned_new(size_t size) +template inline T* ei_conditional_aligned_new(std::size_t size) { T *result = reinterpret_cast(ei_conditional_aligned_malloc(sizeof(T)*size)); return ei_construct_elements_of_array(result, size); @@ -185,7 +185,7 @@ template<> inline void ei_conditional_aligned_free(void *ptr) /** \internal destruct the elements of an array. * The \a size parameters tells on how many objects to call the destructor of T. */ -template inline void ei_destruct_elements_of_array(T *ptr, size_t size) +template inline void ei_destruct_elements_of_array(T *ptr, std::size_t size) { // always destruct an array starting from the end. while(size) ptr[--size].~T(); @@ -194,7 +194,7 @@ template inline void ei_destruct_elements_of_array(T *ptr, size_t si /** \internal delete objects constructed with ei_aligned_new * The \a size parameters tells on how many objects to call the destructor of T. */ -template inline void ei_aligned_delete(T *ptr, size_t size) +template inline void ei_aligned_delete(T *ptr, std::size_t size) { ei_destruct_elements_of_array(ptr, size); ei_aligned_free(ptr); @@ -203,7 +203,7 @@ template inline void ei_aligned_delete(T *ptr, size_t size) /** \internal delete objects constructed with ei_conditional_aligned_new * The \a size parameters tells on how many objects to call the destructor of T. */ -template inline void ei_conditional_aligned_delete(T *ptr, size_t size) +template inline void ei_conditional_aligned_delete(T *ptr, std::size_t size) { ei_destruct_elements_of_array(ptr, size); ei_conditional_aligned_free(ptr); @@ -281,23 +281,23 @@ inline static Integer ei_alignmentOffset(const Scalar* array, Integer size) #if EIGEN_ALIGN #ifdef EIGEN_EXCEPTIONS #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \ - void* operator new(size_t size, const std::nothrow_t&) throw() { \ + void* operator new(std::size_t size, const std::nothrow_t&) throw() { \ try { return Eigen::ei_conditional_aligned_malloc(size); } \ catch (...) { return 0; } \ return 0; \ } #else #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \ - void* operator new(size_t size, const std::nothrow_t&) throw() { \ + void* operator new(std::size_t size, const std::nothrow_t&) throw() { \ return Eigen::ei_conditional_aligned_malloc(size); \ } #endif #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) \ - void *operator new(size_t size) { \ + void *operator new(std::size_t size) { \ return Eigen::ei_conditional_aligned_malloc(size); \ } \ - void *operator new[](size_t size) { \ + void *operator new[](std::size_t size) { \ return Eigen::ei_conditional_aligned_malloc(size); \ } \ void operator delete(void * ptr) throw() { Eigen::ei_conditional_aligned_free(ptr); } \ @@ -305,7 +305,7 @@ inline static Integer ei_alignmentOffset(const Scalar* array, Integer size) /* in-place new and delete. since (at least afaik) there is no actual */ \ /* memory allocated we can safely let the default implementation handle */ \ /* this particular case. */ \ - static void *operator new(size_t size, void *ptr) { return ::operator new(size,ptr); } \ + static void *operator new(std::size_t size, void *ptr) { return ::operator new(size,ptr); } \ void operator delete(void * memory, void *ptr) throw() { return ::operator delete(memory,ptr); } \ /* nothrow-new (returns zero instead of std::bad_alloc) */ \ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \ @@ -339,7 +339,7 @@ template class aligned_allocator { public: - typedef size_t size_type; + typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef T* pointer; typedef const T* const_pointer;