diff --git a/py/mpconfig.h b/py/mpconfig.h index 17c5a770c4967af083a5479cfece9d5c064653c4..44095bd10b783816b470cb231d9ada924a0a78dc 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -4,6 +4,20 @@ #include <mpconfigport.h> +#ifndef INT_FMT +// printf format spec to use for machine_int_t and friends +#ifdef __LP64__ +// Archs where machine_int_t == long, long != int +#define UINT_FMT "%lu" +#define INT_FMT "%ld" +#else +// Archs where machine_int_t == int +#define UINT_FMT "%u" +#define INT_FMT "%d" +#endif +#endif //INT_FMT + + // Any options not explicitly set in mpconfigport.h will get default // values below. diff --git a/unix-cpy/mpconfigport.h b/unix-cpy/mpconfigport.h index db72b31455365b998ac26c7da96eac3de2b10834..983b166a55f7ec32f0c4f0740c9d73e1f5c0dffe 100644 --- a/unix-cpy/mpconfigport.h +++ b/unix-cpy/mpconfigport.h @@ -11,15 +11,11 @@ #ifdef __LP64__ typedef long machine_int_t; // must be pointer size typedef unsigned long machine_uint_t; // must be pointer size -#define UINT_FMT "%lu" -#define INT_FMT "%ld" #else // These are definitions for machines where sizeof(int) == sizeof(void*), // regardless for actual size. typedef int machine_int_t; // must be pointer size typedef unsigned int machine_uint_t; // must be pointer size -#define UINT_FMT "%u" -#define INT_FMT "%d" #endif #define BYTES_PER_WORD sizeof(machine_int_t) diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index 3d0dc8a5677c87657f98eb482bd7e1b8256ce606..36cf138c172faf38e917e921861c2aea5a40dd60 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -11,15 +11,11 @@ #ifdef __LP64__ typedef long machine_int_t; // must be pointer size typedef unsigned long machine_uint_t; // must be pointer size -#define UINT_FMT "%lu" -#define INT_FMT "%ld" #else // These are definitions for machines where sizeof(int) == sizeof(void*), // regardless for actual size. typedef int machine_int_t; // must be pointer size typedef unsigned int machine_uint_t; // must be pointer size -#define UINT_FMT "%u" -#define INT_FMT "%d" #endif #define BYTES_PER_WORD sizeof(machine_int_t)