Replaced all instances of internal::(U)IntPtr with std::(u)intptr_t. Remove ICC workaround.

This commit is contained in:
Colin Broderick
2023-03-21 16:50:23 +00:00
committed by Rasmus Munk Larsen
parent 2c8011c2dd
commit 8f9b8e3630
19 changed files with 52 additions and 68 deletions

View File

@@ -15,8 +15,6 @@
#include <Eigen/Core>
using internal::UIntPtr;
template <typename MatrixType>
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<UIntPtr>(tmp.data());
std::uintptr_t src_address = reinterpret_cast<std::uintptr_t>(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<UIntPtr>(n.data());
std::uintptr_t dst_address = reinterpret_cast<std::uintptr_t>(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<UIntPtr>(tmp.data()), UIntPtr(0));
VERIFY_IS_EQUAL(reinterpret_cast<std::uintptr_t>(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<UIntPtr>(t0.indices().data());
std::uintptr_t t0_address = reinterpret_cast<std::uintptr_t>(t0.indices().data());
// Move constructors:
TranspositionsType t1 = std::move(t0);
UIntPtr t1_address = reinterpret_cast<UIntPtr>(t1.indices().data());
std::uintptr_t t1_address = reinterpret_cast<std::uintptr_t>(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<UIntPtr>(t0.indices().data()), UIntPtr(0));
VERIFY_IS_EQUAL(reinterpret_cast<std::uintptr_t>(t0.indices().data()), std::uintptr_t(0));
// Move assignment:
t0 = std::move(t1);
t0_address = reinterpret_cast<UIntPtr>(t0.indices().data());
t0_address = reinterpret_cast<std::uintptr_t>(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<UIntPtr>(t1.indices().data()), UIntPtr(0));
VERIFY_IS_EQUAL(reinterpret_cast<std::uintptr_t>(t1.indices().data()), std::uintptr_t(0));
Eigen::internal::set_is_malloc_allowed(true);
}