diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-03 16:15:00 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-03 16:15:00 -0800 |
commit | 892af61d4d61cf6e49ba3fa6ac398c8965ae12d3 (patch) | |
tree | bc79d91a7804a5259f368a86e3f21289e636c4ab | |
parent | b7aa72710ee6798c6d2bc2632be24206e526fc1e (diff) | |
parent | c90c0f68a2f1ee8563497a5380a16e71d18d702a (diff) | |
download | micropython-892af61d4d61cf6e49ba3fa6ac398c8965ae12d3.tar.gz micropython-892af61d4d61cf6e49ba3fa6ac398c8965ae12d3.zip |
Merge pull request #56 from pfalcon/int_fmt-global
Move INT_FMT, etc. declaration into global mpconfig.h .
-rw-r--r-- | py/mpconfig.h | 14 | ||||
-rw-r--r-- | unix-cpy/mpconfigport.h | 4 | ||||
-rw-r--r-- | unix/mpconfigport.h | 4 |
3 files changed, 14 insertions, 8 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 17c5a770c4..44095bd10b 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 db72b31455..983b166a55 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 3d0dc8a567..36cf138c17 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) |