BUILD: Define pointer sized integer types and remove SCUMM_64BITS

This commit is contained in:
Bastien Bouclet 2017-09-24 19:06:17 +02:00
parent 9db2953ca3
commit 55f46d3667
6 changed files with 29 additions and 41 deletions

View file

@ -309,26 +309,6 @@
#endif
#endif
//
// Determine 64 bitness
// Reference: http://nadeausoftware.com/articles/2012/02/c_c_tip_how_detect_processor_type_using_compiler_predefined_macros
//
#if !defined(HAVE_CONFIG_H)
#if defined(__x86_64__) || \
defined(_M_X64) || \
defined(__ppc64__) || \
defined(__powerpc64__) || \
defined(__LP64__)
#if !defined(SCUMM_64BITS)
#define SCUMM_64BITS
#endif
#endif
#endif
//
// Some more system specific settings.
// TODO/FIXME: All of these should be moved to backend specific files (such as portdefs.h)
@ -452,6 +432,27 @@
#endif
#endif
//
// Determine 64 bitness
// Reference: http://nadeausoftware.com/articles/2012/02/c_c_tip_how_detect_processor_type_using_compiler_predefined_macros
//
#if !defined(HAVE_CONFIG_H)
#if defined(__x86_64__) || \
defined(_M_X64) || \
defined(__ppc64__) || \
defined(__powerpc64__) || \
defined(__LP64__)
typedef uint64 uintptr;
#else
typedef uint32 uintptr;
#endif
#endif
//
// Overlay color type (FIXME: shouldn't be declared here)

8
configure vendored
View file

@ -2149,13 +2149,11 @@ EOF
echo_n "Checking 64-bitness... "
pointer_is_32bit
if test $? -eq 0; then
type_ptr=int32
type_ptr=uint32
echo "no"
add_line_to_config_h "/* #define SCUMM_64BITS */"
else
type_ptr=int64
type_ptr=uint64
echo "yes"
add_line_to_config_h "#define SCUMM_64BITS"
fi
#
@ -5188,6 +5186,8 @@ typedef signed $type_2_byte int16;
typedef signed $type_4_byte int32;
typedef signed $type_8_byte int64;
typedef $type_ptr uintptr;
#if defined(__APPLE__) && !defined(__ppc__)
#ifndef _UINT64
#define _UINT64

View file

@ -242,10 +242,6 @@ void CMakeProvider::writeDefines(const BuildSetup &setup, std::ofstream &output)
output << " add_definitions(-DPOSIX)\n";
output << "endif()\n";
output << "if (CMAKE_SIZEOF_VOID_P MATCHES 8)\n";
output << " add_definitions(-DSCUMM_64BITS)\n";
output << "endif()\n";
output << "add_definitions(-DSDL_BACKEND)\n\n";
}

View file

@ -158,7 +158,6 @@ void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
// HACK: This definitely should not be here, but otherwise we would not define SDL_BACKEND for x64.
x64Defines.push_back("WIN32");
x64Defines.push_back("SDL_BACKEND");
x64Defines.push_back("SCUMM_64BITS");
outputGlobalPropFile(setup, properties, 64, x64Defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
}

View file

@ -92,12 +92,8 @@ struct Pointer_EqualTo {
struct Pointer_Hash {
uint operator()(const void *x) const {
#ifdef SCUMM_64BITS
uint64 v = (uint64)x;
return (v >> 32) ^ (v & 0xffffffff);
#else
return (uint)x;
#endif
uint x = static_cast<uint>(reinterpret_cast<uintptr>(v));
return x + (x >> 3);
}
};

View file

@ -38,12 +38,8 @@ struct Pointer_EqualTo {
struct Pointer_Hash {
uint operator()(const void *x) const {
#ifdef SCUMM_64BITS
uint64 v = (uint64)x;
return (v >> 32) ^ (v & 0xffffffff);
#else
return (uint)x;
#endif
uint x = static_cast<uint>(reinterpret_cast<uintptr>(v));
return x + (x >> 3);
}
};