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

@@ -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<float>(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<typename T> 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; i<g_repeat*100; ++i)
{
MyStruct *foo0 = new MyStruct(); VERIFY(internal::UIntPtr(foo0->avec.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; i<g_repeat*100; ++i)
{
MyStruct *foo0 = new MyStruct[N]; VERIFY(internal::UIntPtr(foo0->avec.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;
}