From 8f9b8e36304de19df83f4e6b3f3b2b150e03e3bb Mon Sep 17 00:00:00 2001 From: Colin Broderick Date: Tue, 21 Mar 2023 16:50:23 +0000 Subject: [PATCH] Replaced all instances of internal::(U)IntPtr with std::(u)intptr_t. Remove ICC workaround. --- Eigen/src/Core/AssignEvaluator.h | 2 +- Eigen/src/Core/CoreEvaluators.h | 2 +- Eigen/src/Core/DenseStorage.h | 2 +- Eigen/src/Core/GeneralProduct.h | 2 +- Eigen/src/Core/MapBase.h | 2 +- Eigen/src/Core/Reshaped.h | 2 +- Eigen/src/Core/products/GeneralMatrixMatrix.h | 4 ++-- Eigen/src/Core/util/BlasUtil.h | 4 ++-- Eigen/src/Core/util/Memory.h | 12 +++++----- Eigen/src/Core/util/Meta.h | 14 ------------ test/dynalloc.cpp | 22 +++++++++---------- test/evaluators.cpp | 2 +- test/first_aligned.cpp | 2 +- test/mapped_matrix.cpp | 6 ++--- test/mapstride.cpp | 8 +++---- test/rvalue_types.cpp | 18 +++++++-------- test/stdvector.cpp | 6 ++--- test/stdvector_overload.cpp | 6 ++--- unsupported/test/cxx11_maxsizevector.cpp | 4 ++-- 19 files changed, 52 insertions(+), 68 deletions(-) diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h index 2b3a1c79b..d3be1923c 100644 --- a/Eigen/src/Core/AssignEvaluator.h +++ b/Eigen/src/Core/AssignEvaluator.h @@ -550,7 +550,7 @@ struct dense_assignment_loop : int(Kernel::AssignmentTraits::DstAlignment) }; const Scalar *dst_ptr = kernel.dstDataPtr(); - if((!bool(dstIsAligned)) && (UIntPtr(dst_ptr) % sizeof(Scalar))>0) + if((!bool(dstIsAligned)) && (std::uintptr_t(dst_ptr) % sizeof(Scalar))>0) { // the pointer is not aligned-on scalar, so alignment is not possible return dense_assignment_loop::run(kernel); diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h index 1729507cc..e233efba1 100644 --- a/Eigen/src/Core/CoreEvaluators.h +++ b/Eigen/src/Core/CoreEvaluators.h @@ -1225,7 +1225,7 @@ struct block_evaluator(block) { - eigen_internal_assert((internal::is_constant_evaluated() || (internal::UIntPtr(block.data()) % plain_enum_max(1,evaluator::Alignment)) == 0) \ + eigen_internal_assert((internal::is_constant_evaluated() || (std::uintptr_t(block.data()) % plain_enum_max(1,evaluator::Alignment)) == 0) \ && "data is not aligned"); } }; diff --git a/Eigen/src/Core/DenseStorage.h b/Eigen/src/Core/DenseStorage.h index b409a392b..11205fa40 100644 --- a/Eigen/src/Core/DenseStorage.h +++ b/Eigen/src/Core/DenseStorage.h @@ -56,7 +56,7 @@ struct plain_array #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) #else #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ - eigen_assert((internal::is_constant_evaluated() || (internal::UIntPtr(array) & (sizemask)) == 0) \ + eigen_assert((internal::is_constant_evaluated() || (std::uintptr_t(array) & (sizemask)) == 0) \ && "this assertion is explained here: " \ "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ " **** READ THIS WEB PAGE !!! ****"); diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index 661a3c4dd..9f693baa2 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -191,7 +191,7 @@ struct gemv_static_vector_if internal::plain_array m_data; EIGEN_STRONG_INLINE Scalar* data() { return ForceAlignment - ? reinterpret_cast((internal::UIntPtr(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES) + ? reinterpret_cast((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES) : m_data.array; } #endif diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h index bf8c16397..4dda24d21 100644 --- a/Eigen/src/Core/MapBase.h +++ b/Eigen/src/Core/MapBase.h @@ -197,7 +197,7 @@ template class MapBase // innerStride() is not set yet when this function is called, so we optimistically assume the lowest plausible value: const Index minInnerStride = InnerStrideAtCompileTime == Dynamic ? 1 : Index(InnerStrideAtCompileTime); EIGEN_ONLY_USED_FOR_DEBUG(minInnerStride); - eigen_assert(( ((internal::UIntPtr(m_data) % internal::traits::Alignment) == 0) + eigen_assert(( ((std::uintptr_t(m_data) % internal::traits::Alignment) == 0) || (cols() * rows() * minInnerStride * sizeof(Scalar)) < internal::traits::Alignment ) && "data is not aligned"); #endif } diff --git a/Eigen/src/Core/Reshaped.h b/Eigen/src/Core/Reshaped.h index 81355ace5..508bc2529 100644 --- a/Eigen/src/Core/Reshaped.h +++ b/Eigen/src/Core/Reshaped.h @@ -444,7 +444,7 @@ struct reshaped_evaluator(xpr) { // TODO: for the 3.4 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime - eigen_assert(((internal::UIntPtr(xpr.data()) % plain_enum_max(1, evaluator::Alignment)) == 0) && "data is not aligned"); + eigen_assert(((std::uintptr_t(xpr.data()) % plain_enum_max(1, evaluator::Alignment)) == 0) && "data is not aligned"); } }; diff --git a/Eigen/src/Core/products/GeneralMatrixMatrix.h b/Eigen/src/Core/products/GeneralMatrixMatrix.h index 38bddacdb..9f2a53da1 100644 --- a/Eigen/src/Core/products/GeneralMatrixMatrix.h +++ b/Eigen/src/Core/products/GeneralMatrixMatrix.h @@ -311,8 +311,8 @@ class gemm_blocking_spacem_blockA = m_staticA; this->m_blockB = m_staticB; #else - this->m_blockA = reinterpret_cast((internal::UIntPtr(m_staticA) + (EIGEN_DEFAULT_ALIGN_BYTES-1)) & ~std::size_t(EIGEN_DEFAULT_ALIGN_BYTES-1)); - this->m_blockB = reinterpret_cast((internal::UIntPtr(m_staticB) + (EIGEN_DEFAULT_ALIGN_BYTES-1)) & ~std::size_t(EIGEN_DEFAULT_ALIGN_BYTES-1)); + this->m_blockA = reinterpret_cast((std::uintptr_t(m_staticA) + (EIGEN_DEFAULT_ALIGN_BYTES-1)) & ~std::size_t(EIGEN_DEFAULT_ALIGN_BYTES-1)); + this->m_blockB = reinterpret_cast((std::uintptr_t(m_staticB) + (EIGEN_DEFAULT_ALIGN_BYTES-1)) & ~std::size_t(EIGEN_DEFAULT_ALIGN_BYTES-1)); #endif } diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h index 979d974a7..41fbe1538 100644 --- a/Eigen/src/Core/util/BlasUtil.h +++ b/Eigen/src/Core/util/BlasUtil.h @@ -66,7 +66,7 @@ class BlasVectorMapper { template EIGEN_DEVICE_FUNC bool aligned(Index i) const { - return (UIntPtr(m_data+i)%sizeof(Packet))==0; + return (std::uintptr_t(m_data+i)%sizeof(Packet))==0; } protected: @@ -253,7 +253,7 @@ public: EIGEN_DEVICE_FUNC const Scalar* data() const { return m_data; } EIGEN_DEVICE_FUNC Index firstAligned(Index size) const { - if (UIntPtr(m_data)%sizeof(Scalar)) { + if (std::uintptr_t(m_data)%sizeof(Scalar)) { return -1; } return internal::first_default_aligned(m_data, size); diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index a39c71876..13d029c5e 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -541,7 +541,7 @@ EIGEN_DEVICE_FUNC inline Index first_aligned(const Scalar* array, Index size) // so that all elements of the array have the same alignment. return 0; } - else if( (UIntPtr(array) & (sizeof(Scalar)-1)) || (Alignment%ScalarSize)!=0) + else if( (std::uintptr_t(array) & (sizeof(Scalar)-1)) || (Alignment%ScalarSize)!=0) { // The array is not aligned to the size of a single scalar, or the requested alignment is not a multiple of the scalar size. // Consequently, no element of the array is well aligned. @@ -549,7 +549,7 @@ EIGEN_DEVICE_FUNC inline Index first_aligned(const Scalar* array, Index size) } else { - Index first = (AlignmentSize - (Index((UIntPtr(array)/sizeof(Scalar))) & AlignmentMask)) & AlignmentMask; + Index first = (AlignmentSize - (Index((std::uintptr_t(array)/sizeof(Scalar))) & AlignmentMask)) & AlignmentMask; return (first < size) ? first : size; } } @@ -583,7 +583,7 @@ template EIGEN_DEVICE_FUNC void smart_copy(const T* start, const T* template struct smart_copy_helper { EIGEN_DEVICE_FUNC static inline void run(const T* start, const T* end, T* target) { - IntPtr size = IntPtr(end)-IntPtr(start); + std::intptr_t size = std::intptr_t(end)-std::intptr_t(start); if(size==0) return; eigen_internal_assert(start!=0 && end!=0 && target!=0); EIGEN_USING_STD(memcpy) @@ -607,7 +607,7 @@ template void smart_memmove(const T* start, const T* end, T* target) template struct smart_memmove_helper { static inline void run(const T* start, const T* end, T* target) { - IntPtr size = IntPtr(end)-IntPtr(start); + std::intptr_t size = std::intptr_t(end)-std::intptr_t(start); if(size==0) return; eigen_internal_assert(start!=0 && end!=0 && target!=0); std::memmove(target, start, size); @@ -617,7 +617,7 @@ template struct smart_memmove_helper { template struct smart_memmove_helper { static inline void run(const T* start, const T* end, T* target) { - if (UIntPtr(target) < UIntPtr(start)) + if (std::uintptr_t(target) < std::uintptr_t(start)) { std::copy(start, end, target); } @@ -799,7 +799,7 @@ template void swap(scoped_array &a,scoped_array &b) #if EIGEN_DEFAULT_ALIGN_BYTES>0 // We always manually re-align the result of EIGEN_ALLOCA. // If alloca is already aligned, the compiler should be smart enough to optimize away the re-alignment. - #define EIGEN_ALIGNED_ALLOCA(SIZE) reinterpret_cast((internal::UIntPtr(EIGEN_ALLOCA(SIZE+EIGEN_DEFAULT_ALIGN_BYTES-1)) + EIGEN_DEFAULT_ALIGN_BYTES-1) & ~(std::size_t(EIGEN_DEFAULT_ALIGN_BYTES-1))) + #define EIGEN_ALIGNED_ALLOCA(SIZE) reinterpret_cast((std::uintptr_t(EIGEN_ALLOCA(SIZE+EIGEN_DEFAULT_ALIGN_BYTES-1)) + EIGEN_DEFAULT_ALIGN_BYTES-1) & ~(std::size_t(EIGEN_DEFAULT_ALIGN_BYTES-1))) #else #define EIGEN_ALIGNED_ALLOCA(SIZE) EIGEN_ALLOCA(SIZE) #endif diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 740b10f94..a192aac87 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -27,9 +27,6 @@ #endif -// Recent versions of ICC require for pointer types below. -#define EIGEN_ICC_NEEDS_CSTDINT (EIGEN_COMP_ICC>=1600) - // Define portable (u)int{32,64} types #include @@ -93,17 +90,6 @@ namespace internal { * we however don't want to add a dependency to Boost. */ -// Only recent versions of ICC complain about using ptrdiff_t to hold pointers, -// and older versions do not provide *intptr_t types. -#if EIGEN_ICC_NEEDS_CSTDINT -typedef std::intptr_t IntPtr; -typedef std::uintptr_t UIntPtr; -#else -typedef std::ptrdiff_t IntPtr; -typedef std::size_t UIntPtr; -#endif -#undef EIGEN_ICC_NEEDS_CSTDINT - struct true_type { enum { value = 1 }; }; struct false_type { enum { value = 0 }; }; diff --git a/test/dynalloc.cpp b/test/dynalloc.cpp index cdc10ee89..f75ff6cf7 100644 --- a/test/dynalloc.cpp +++ b/test/dynalloc.cpp @@ -26,7 +26,7 @@ void check_handmade_aligned_malloc() for(int i = 1; i < 1000; i++) { char *p = (char*)internal::handmade_aligned_malloc(i, alignment); - VERIFY(internal::UIntPtr(p)%ALIGNMENT==0); + VERIFY(std::uintptr_t(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; internal::handmade_aligned_free(p); @@ -38,7 +38,7 @@ void check_aligned_malloc() for(int i = ALIGNMENT; i < 1000; i++) { char *p = (char*)internal::aligned_malloc(i); - VERIFY(internal::UIntPtr(p)%ALIGNMENT==0); + VERIFY(std::uintptr_t(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; internal::aligned_free(p); @@ -50,7 +50,7 @@ void check_aligned_new() for(int i = ALIGNMENT; i < 1000; i++) { float *p = internal::aligned_new(i); - VERIFY(internal::UIntPtr(p)%ALIGNMENT==0); + VERIFY(std::uintptr_t(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; internal::aligned_delete(p,i); @@ -62,7 +62,7 @@ void check_aligned_stack_alloc() for(int i = ALIGNMENT; i < 400; i++) { ei_declare_aligned_stack_constructed_variable(float,p,i,0); - VERIFY(internal::UIntPtr(p)%ALIGNMENT==0); + VERIFY(std::uintptr_t(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; } @@ -92,7 +92,7 @@ template void check_dynaligned() { T* obj = new T; VERIFY(T::NeedsToAlign==1); - VERIFY(internal::UIntPtr(obj)%ALIGNMENT==0); + VERIFY(std::uintptr_t(obj)%ALIGNMENT==0); delete obj; } } @@ -153,15 +153,15 @@ EIGEN_DECLARE_TEST(dynalloc) } { - MyStruct foo0; VERIFY(internal::UIntPtr(foo0.avec.data())%ALIGNMENT==0); - MyClassA fooA; VERIFY(internal::UIntPtr(fooA.avec.data())%ALIGNMENT==0); + MyStruct foo0; VERIFY(std::uintptr_t(foo0.avec.data())%ALIGNMENT==0); + MyClassA fooA; VERIFY(std::uintptr_t(fooA.avec.data())%ALIGNMENT==0); } // dynamic allocation, single object for (int i=0; iavec.data())%ALIGNMENT==0); - MyClassA *fooA = new MyClassA(); VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0); + MyStruct *foo0 = new MyStruct(); VERIFY(std::uintptr_t(foo0->avec.data())%ALIGNMENT==0); + MyClassA *fooA = new MyClassA(); VERIFY(std::uintptr_t(fooA->avec.data())%ALIGNMENT==0); delete foo0; delete fooA; } @@ -170,8 +170,8 @@ EIGEN_DECLARE_TEST(dynalloc) const int N = 10; for (int i=0; iavec.data())%ALIGNMENT==0); - MyClassA *fooA = new MyClassA[N]; VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0); + MyStruct *foo0 = new MyStruct[N]; VERIFY(std::uintptr_t(foo0->avec.data())%ALIGNMENT==0); + MyClassA *fooA = new MyClassA[N]; VERIFY(std::uintptr_t(fooA->avec.data())%ALIGNMENT==0); delete[] foo0; delete[] fooA; } diff --git a/test/evaluators.cpp b/test/evaluators.cpp index 95bfb45d3..0f9b6f85e 100644 --- a/test/evaluators.cpp +++ b/test/evaluators.cpp @@ -512,7 +512,7 @@ EIGEN_DECLARE_TEST(evaluators) float *destMem = new float[(M*N) + 1]; // In case of no alignment, avoid division by zero. constexpr int alignment = (std::max)(EIGEN_MAX_ALIGN_BYTES, 1); - float *dest = (internal::UIntPtr(destMem)%alignment) == 0 ? destMem+1 : destMem; + float *dest = (std::uintptr_t(destMem)%alignment) == 0 ? destMem+1 : destMem; const Matrix a = Matrix::Random(M, K); const Matrix b = Matrix::Random(K, N); diff --git a/test/first_aligned.cpp b/test/first_aligned.cpp index ed9945077..aaa4d0128 100644 --- a/test/first_aligned.cpp +++ b/test/first_aligned.cpp @@ -41,7 +41,7 @@ EIGEN_DECLARE_TEST(first_aligned) test_first_aligned_helper(array_double+1, 50); test_first_aligned_helper(array_double+2, 50); - double *array_double_plus_4_bytes = (double*)(internal::UIntPtr(array_double)+4); + double *array_double_plus_4_bytes = (double*)(std::uintptr_t(array_double)+4); test_none_aligned_helper(array_double_plus_4_bytes, 50); test_none_aligned_helper(array_double_plus_4_bytes+1, 50); diff --git a/test/mapped_matrix.cpp b/test/mapped_matrix.cpp index 1dd695911..7270d030b 100644 --- a/test/mapped_matrix.cpp +++ b/test/mapped_matrix.cpp @@ -22,7 +22,7 @@ template void map_class_vector(const VectorType& m) Scalar* array3 = new Scalar[size+1]; // In case of no alignment, avoid division by zero. constexpr int alignment = (std::max)(EIGEN_MAX_ALIGN_BYTES, 1); - Scalar* array3unaligned = (internal::UIntPtr(array3)%alignment) == 0 ? array3+1 : array3; + Scalar* array3unaligned = (std::uintptr_t(array3)%alignment) == 0 ? array3+1 : array3; Scalar array4[EIGEN_TESTMAP_MAX_SIZE]; Map(array1, size) = VectorType::Random(size); @@ -64,7 +64,7 @@ template void map_class_matrix(const MatrixType& m) for(Index i = 0; i < sizep1; i++) array3[i] = Scalar(1); // In case of no alignment, avoid division by zero. constexpr int alignment = (std::max)(EIGEN_MAX_ALIGN_BYTES, 1); - Scalar* array3unaligned = (internal::UIntPtr(array3)%alignment) == 0 ? array3+1 : array3; + Scalar* array3unaligned = (std::uintptr_t(array3)%alignment) == 0 ? array3+1 : array3; Scalar array4[256]; if(size<=256) for(int i = 0; i < size; i++) array4[i] = Scalar(1); @@ -129,7 +129,7 @@ template void map_static_methods(const VectorType& m) Scalar* array3 = new Scalar[size+1]; // In case of no alignment, avoid division by zero. constexpr int alignment = (std::max)(EIGEN_MAX_ALIGN_BYTES, 1); - Scalar* array3unaligned = (internal::UIntPtr(array3)%alignment) == 0 ? array3+1 : array3; + Scalar* array3unaligned = (std::uintptr_t(array3)%alignment) == 0 ? array3+1 : array3; VectorType::MapAligned(array1, size) = VectorType::Random(size); VectorType::Map(array2, size) = VectorType::Map(array1, size); diff --git a/test/mapstride.cpp b/test/mapstride.cpp index 42ceb0cf8..107e1e3d5 100644 --- a/test/mapstride.cpp +++ b/test/mapstride.cpp @@ -22,7 +22,7 @@ template void map_class_vector(const VectorTy Scalar* a_array = internal::aligned_new(arraysize+1); Scalar* array = a_array; if(Alignment!=Aligned) - array = (Scalar*)(internal::IntPtr(a_array) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); + array = (Scalar*)(std::intptr_t(a_array) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); { Map > map(array, size); @@ -61,16 +61,16 @@ template void map_class_matrix(const MatrixTy Scalar* a_array1 = internal::aligned_new(arraysize+1); Scalar* array1 = a_array1; if(Alignment!=Aligned) - array1 = (Scalar*)(internal::IntPtr(a_array1) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); + array1 = (Scalar*)(std::intptr_t(a_array1) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); Scalar a_array2[256]; Scalar* array2 = a_array2; if(Alignment!=Aligned) { - array2 = (Scalar*)(internal::IntPtr(a_array2) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); + array2 = (Scalar*)(std::intptr_t(a_array2) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); } else { // In case there is no alignment, default to pointing to the start. constexpr int alignment = (std::max)(EIGEN_MAX_ALIGN_BYTES, 1); - array2 = (Scalar*)(((internal::UIntPtr(a_array2)+alignment-1)/alignment)*alignment); + array2 = (Scalar*)(((std::uintptr_t(a_array2)+alignment-1)/alignment)*alignment); } Index maxsize2 = a_array2 - array2 + 256; diff --git a/test/rvalue_types.cpp b/test/rvalue_types.cpp index 9af7c9287..01df21b3d 100644 --- a/test/rvalue_types.cpp +++ b/test/rvalue_types.cpp @@ -15,8 +15,6 @@ #include -using internal::UIntPtr; - template void rvalue_copyassign(const MatrixType& m) { @@ -25,18 +23,18 @@ void rvalue_copyassign(const MatrixType& m) // create a temporary which we are about to destroy by moving MatrixType tmp = m; - UIntPtr src_address = reinterpret_cast(tmp.data()); + std::uintptr_t src_address = reinterpret_cast(tmp.data()); Eigen::internal::set_is_malloc_allowed(false); // moving from an rvalue reference shall never allocate // move the temporary to n MatrixType n = std::move(tmp); - UIntPtr dst_address = reinterpret_cast(n.data()); + std::uintptr_t dst_address = reinterpret_cast(n.data()); if (MatrixType::RowsAtCompileTime==Dynamic|| MatrixType::ColsAtCompileTime==Dynamic) { // verify that we actually moved the guts VERIFY_IS_EQUAL(src_address, dst_address); VERIFY_IS_EQUAL(tmp.size(), 0); - VERIFY_IS_EQUAL(reinterpret_cast(tmp.data()), UIntPtr(0)); + VERIFY_IS_EQUAL(reinterpret_cast(tmp.data()), std::uintptr_t(0)); } // verify that the content did not change @@ -55,24 +53,24 @@ void rvalue_transpositions(Index rows) Eigen::internal::set_is_malloc_allowed(false); // moving from an rvalue reference shall never allocate - UIntPtr t0_address = reinterpret_cast(t0.indices().data()); + std::uintptr_t t0_address = reinterpret_cast(t0.indices().data()); // Move constructors: TranspositionsType t1 = std::move(t0); - UIntPtr t1_address = reinterpret_cast(t1.indices().data()); + std::uintptr_t t1_address = reinterpret_cast(t1.indices().data()); VERIFY_IS_EQUAL(t0_address, t1_address); // t0 must be de-allocated: VERIFY_IS_EQUAL(t0.size(), 0); - VERIFY_IS_EQUAL(reinterpret_cast(t0.indices().data()), UIntPtr(0)); + VERIFY_IS_EQUAL(reinterpret_cast(t0.indices().data()), std::uintptr_t(0)); // Move assignment: t0 = std::move(t1); - t0_address = reinterpret_cast(t0.indices().data()); + t0_address = reinterpret_cast(t0.indices().data()); VERIFY_IS_EQUAL(t0_address, t1_address); // t1 must be de-allocated: VERIFY_IS_EQUAL(t1.size(), 0); - VERIFY_IS_EQUAL(reinterpret_cast(t1.indices().data()), UIntPtr(0)); + VERIFY_IS_EQUAL(reinterpret_cast(t1.indices().data()), std::uintptr_t(0)); Eigen::internal::set_is_malloc_allowed(true); } diff --git a/test/stdvector.cpp b/test/stdvector.cpp index 18de240c6..2ca584b9d 100644 --- a/test/stdvector.cpp +++ b/test/stdvector.cpp @@ -34,7 +34,7 @@ void check_stdvector_matrix(const MatrixType& m) VERIFY_IS_APPROX(v[21], y); v.push_back(x); VERIFY_IS_APPROX(v[22], x); - VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(MatrixType)); + VERIFY((std::uintptr_t)&(v[22]) == (std::uintptr_t)&(v[21]) + sizeof(MatrixType)); // do a lot of push_back such that the vector gets internally resized // (with memory reallocation) @@ -69,7 +69,7 @@ void check_stdvector_transform(const TransformType&) VERIFY_IS_APPROX(v[21], y); v.push_back(x); VERIFY_IS_APPROX(v[22], x); - VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(TransformType)); + VERIFY((std::uintptr_t)&(v[22]) == (std::uintptr_t)&(v[21]) + sizeof(TransformType)); // do a lot of push_back such that the vector gets internally resized // (with memory reallocation) @@ -104,7 +104,7 @@ void check_stdvector_quaternion(const QuaternionType&) VERIFY_IS_APPROX(v[21], y); v.push_back(x); VERIFY_IS_APPROX(v[22], x); - VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(QuaternionType)); + VERIFY((std::uintptr_t)&(v[22]) == (std::uintptr_t)&(v[21]) + sizeof(QuaternionType)); // do a lot of push_back such that the vector gets internally resized // (with memory reallocation) diff --git a/test/stdvector_overload.cpp b/test/stdvector_overload.cpp index da04f8a84..2fbbb31f9 100644 --- a/test/stdvector_overload.cpp +++ b/test/stdvector_overload.cpp @@ -48,7 +48,7 @@ void check_stdvector_matrix(const MatrixType& m) VERIFY_IS_APPROX(v[21], y); v.push_back(x); VERIFY_IS_APPROX(v[22], x); - VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(MatrixType)); + VERIFY((std::uintptr_t)&(v[22]) == (std::uintptr_t)&(v[21]) + sizeof(MatrixType)); // do a lot of push_back such that the vector gets internally resized // (with memory reallocation) @@ -83,7 +83,7 @@ void check_stdvector_transform(const TransformType&) VERIFY_IS_APPROX(v[21], y); v.push_back(x); VERIFY_IS_APPROX(v[22], x); - VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(TransformType)); + VERIFY((std::uintptr_t)&(v[22]) == (std::uintptr_t)&(v[21]) + sizeof(TransformType)); // do a lot of push_back such that the vector gets internally resized // (with memory reallocation) @@ -118,7 +118,7 @@ void check_stdvector_quaternion(const QuaternionType&) VERIFY_IS_APPROX(v[21], y); v.push_back(x); VERIFY_IS_APPROX(v[22], x); - VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(QuaternionType)); + VERIFY((std::uintptr_t)&(v[22]) == (std::uintptr_t)&(v[21]) + sizeof(QuaternionType)); // do a lot of push_back such that the vector gets internally resized // (with memory reallocation) diff --git a/unsupported/test/cxx11_maxsizevector.cpp b/unsupported/test/cxx11_maxsizevector.cpp index 46b689a8e..22b51ba6a 100644 --- a/unsupported/test/cxx11_maxsizevector.cpp +++ b/unsupported/test/cxx11_maxsizevector.cpp @@ -18,13 +18,13 @@ struct Foo #endif std::cout << '+'; ++Foo::object_count; - eigen_assert((internal::UIntPtr(this) & (127)) == 0); + eigen_assert((std::uintptr_t(this) & (127)) == 0); } Foo(const Foo&) { std::cout << 'c'; ++Foo::object_count; - eigen_assert((internal::UIntPtr(this) & (127)) == 0); + eigen_assert((std::uintptr_t(this) & (127)) == 0); } ~Foo()