From cd40eba4537b583211aa50a7275ea066970745b8 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 27 Feb 2024 20:17:18 +0000 Subject: [PATCH] Add an option to disable use of tagged pointers --- CMakeLists.txt | 4 ++++ src/core/endian_type.hpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5e339ad5c..03f5bf2368 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -536,6 +536,10 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) add_definitions(-DPOINTER_IS_64BIT) endif() +if(OPTION_NO_TAGGED_PTRS) + add_definitions(-DNO_TAGGED_PTRS) +endif() + enable_testing() add_subdirectory(regression) diff --git a/src/core/endian_type.hpp b/src/core/endian_type.hpp index 418e29f027..89c47e4956 100644 --- a/src/core/endian_type.hpp +++ b/src/core/endian_type.hpp @@ -27,7 +27,7 @@ # error "TTD_ENDIAN is not defined; please set it to either TTD_LITTLE_ENDIAN or TTD_BIG_ENDIAN" #endif /* !TTD_ENDIAN */ -#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64) +#if !defined(NO_TAGGED_PTRS) && (defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64)) /** Tagged pointers (upper bits) may be used on this architecture */ # define OTTD_UPPER_TAGGED_PTR 1 #else