Commit 933e9e407b broke the simulator on a 64-bit platform.

This commit is contained in:
Gregory Nutt 2019-07-29 14:34:29 -06:00
parent c71f2fa56f
commit eef2f4599e
2 changed files with 32 additions and 26 deletions

View File

@ -44,48 +44,54 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define CHAR_BIT 8 #define CHAR_BIT 8
#define SCHAR_MIN (-SCHAR_MAX - 1) #define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127 #define SCHAR_MAX 127
#define UCHAR_MAX 255 #define UCHAR_MAX 255
/* These could be different on machines where char is unsigned */ /* These could be different on machines where char is unsigned */
#ifdef __CHAR_UNSIGNED__ #ifdef __CHAR_UNSIGNED__
#define CHAR_MIN 0 #define CHAR_MIN 0
#define CHAR_MAX UCHAR_MAX #define CHAR_MAX UCHAR_MAX
#else #else
#define CHAR_MIN SCHAR_MIN #define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX #define CHAR_MAX SCHAR_MAX
#endif #endif
#define SHRT_MIN (-SHRT_MAX - 1) #define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767 #define SHRT_MAX 32767
#define USHRT_MAX 65535U #define USHRT_MAX 65535U
#define INT_MIN (-INT_MAX - 1) #define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647 #define INT_MAX 2147483647
#define UINT_MAX 4294967295U #define UINT_MAX 4294967295U
/* These change on 32-bit and 64-bit platforms */ /* These change on 32-bit and 64-bit platforms */
#define LONG_MIN (-LONG_MAX - 1) #if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)
#define LONG_MAX 2147483647L # define LONG_MIN (-LONG_MAX - 1)
#define ULONG_MAX 4294967295UL # define LONG_MAX 2147483647L
# define ULONG_MAX 4294967295UL
#else
# define LONG_MIN (-LLONG_MAX - 1)
# define LONG_MAX 9223372036854775807LL
# define ULONG_MAX 18446744073709551615ULL
#endif
#define LLONG_MIN (-LLONG_MAX - 1) #define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL #define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL #define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 4 or 8 bytes */ /* A pointer is 4 or 8 bytes */
#define PTR_MIN (-PTR_MAX - 1) #define PTR_MIN (-PTR_MAX - 1)
#if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32) #if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)
# define PTR_MAX 2147483647 # define PTR_MAX 2147483647
# define UPTR_MAX 4294967295U # define UPTR_MAX 4294967295U
#else #else
# define PTR_MAX 9223372036854775807LL # define PTR_MAX 9223372036854775807LL
# define UPTR_MAX 18446744073709551615ULL # define UPTR_MAX 18446744073709551615ULL
#endif #endif
#endif /* __ARCH_SIM_INCLUDE_LIMITS_H */ #endif /* __ARCH_SIM_INCLUDE_LIMITS_H */

View File

@ -395,7 +395,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
c = 'l'; c = 'l';
break; break;
#ifdef CONFIG_HAVE_LONG_LONG #if defined(CONFIG_LIBC_LONG_LONG) && ULLONG_MAX != ULONG_MAX
case sizeof(unsigned long long): case sizeof(unsigned long long):
c = 'l'; c = 'l';
flags |= FL_LONG; flags |= FL_LONG;