Redo SIZEOF_OFF_T using __SIZEOF_SIZE_T__ instead of checking for CPUs

This commit is contained in:
Boris Kolpackov 2022-09-04 10:18:57 +02:00
parent a64598861f
commit 2062ab7e57

View File

@ -2,13 +2,18 @@
#undef SIZEOF_OFF_T #undef SIZEOF_OFF_T
/* Note that the _FILE_OFFSET_BITS macro is expected to be defined by the
/* Use __SIZEOF_SIZE_T__ (defined by GCC and Clang and maybe others) to detect
* a 64-bit target.
*
* Note that the _FILE_OFFSET_BITS macro is expected to be defined by the
* user, for example, on the command line. * user, for example, on the command line.
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
# define SIZEOF_OFF_T 4 # define SIZEOF_OFF_T 4
#elif defined(__x86_64__) || defined(__ppc64__) || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64) #elif (defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 8) || \
(defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64)
# define SIZEOF_OFF_T 8 # define SIZEOF_OFF_T 8
#else #else
# define SIZEOF_OFF_T 4 # define SIZEOF_OFF_T 4