From 0173ba07b483b762dc7c262d77c98b0be35d7fe4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 23 Dec 2010 09:47:05 +0900 Subject: [PATCH] Prefer int over long for (u)int32_t. WHen int and long are the same size, it feels better to use int. More importantly, it keeps things simple for linux builds vs mingw builds. --- include/pstdint.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/include/pstdint.h b/include/pstdint.h index a5caf2a91..dda2949f4 100644 --- a/include/pstdint.h +++ b/include/pstdint.h @@ -327,18 +327,18 @@ # define UINT32_MAX (0xffffffffUL) #endif #ifndef uint32_t -#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) - typedef unsigned long uint32_t; -# define UINT32_C(v) v ## UL -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (UINT_MAX == UINT32_MAX) +#if (UINT_MAX == UINT32_MAX) typedef unsigned int uint32_t; # ifndef PRINTF_INT32_MODIFIER # define PRINTF_INT32_MODIFIER "" # endif # define UINT32_C(v) v ## U +#elif (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) + typedef unsigned long uint32_t; +# define UINT32_C(v) v ## UL +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "l" +# endif #elif (USHRT_MAX == UINT32_MAX) typedef unsigned short uint32_t; # define UINT32_C(v) ((unsigned short) (v)) @@ -357,18 +357,18 @@ # define INT32_MIN INT32_C(0x80000000) #endif #ifndef int32_t -#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) - typedef signed long int32_t; -# define INT32_C(v) v ## L -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (INT_MAX == INT32_MAX) +#if (INT_MAX == INT32_MAX) typedef signed int int32_t; # define INT32_C(v) v # ifndef PRINTF_INT32_MODIFIER # define PRINTF_INT32_MODIFIER "" # endif +#elif (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) + typedef signed long int32_t; +# define INT32_C(v) v ## L +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "l" +# endif #elif (SHRT_MAX == INT32_MAX) typedef signed short int32_t; # define INT32_C(v) ((short) (v)) @@ -596,7 +596,7 @@ typedef uint_least32_t uint_fast32_t; * Whatever piecemeal, per compiler thing we can do about the wchar_t * type limits. */ - +#if 0 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) # include # ifndef WCHAR_MIN @@ -606,7 +606,7 @@ typedef uint_least32_t uint_fast32_t; # define WCHAR_MAX ((wchar_t)-1) # endif #endif - +#endif /* * Whatever piecemeal, per compiler/platform thing we can do about the * (u)intptr_t types and limits.