mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Replaced all instances of internal::(U)IntPtr with std::(u)intptr_t. Remove ICC workaround.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
2c8011c2dd
commit
8f9b8e3630
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user