src: introduce ptr_get_address()

This commit is contained in:
Markus F.X.J. Oberhumer
2024-05-11 17:37:15 +02:00
parent 07b533f95b
commit cba44c45fc
8 changed files with 38 additions and 24 deletions
+8
View File
@@ -498,8 +498,16 @@ void upx_compiler_sanity_check(void) noexcept {
CheckIntegral<ptrdiff_t>::check();
CheckIntegral<size_t>::check();
CheckIntegral<upx_off_t>::check();
CheckIntegral<upx_ptraddr_t>::check();
CheckIntegral<upx_uintptr_t>::check();
COMPILE_TIME_ASSERT(ptrdiff_t(0) - 1 < 0);
COMPILE_TIME_ASSERT(intptr_t(0) - 1 < 0);
COMPILE_TIME_ASSERT(size_t(0) - 1 > 0);
COMPILE_TIME_ASSERT(uintptr_t(0) - 1 > 0);
COMPILE_TIME_ASSERT(upx_ptraddr_t(0) - 1 > 0);
COMPILE_TIME_ASSERT(upx_uintptr_t(0) - 1 > 0);
COMPILE_TIME_ASSERT(sizeof(upx_charptr_unit_type) == 1)
COMPILE_TIME_ASSERT_ALIGNED1(upx_charptr_unit_type)
COMPILE_TIME_ASSERT(sizeof(*((charptr) nullptr)) == 1)