OSDN Git Service

2005-10-04 Ralf Corsepius <ralf.corsepius@rtems.org>
authorjjohnstn <jjohnstn>
Tue, 4 Oct 2005 21:02:59 +0000 (21:02 +0000)
committerjjohnstn <jjohnstn>
Tue, 4 Oct 2005 21:02:59 +0000 (21:02 +0000)
        * libc/include/stdint.h: Move magic to set __have_long* to the
        beginning.  Use #if __have* instead of #if defined(__have*).
        Minor typo fixes.

newlib/ChangeLog
newlib/libc/include/stdint.h

index f2a259b..90ed463 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-04  Ralf Corsepius <ralf.corsepius@rtems.org>
+
+       * libc/include/stdint.h: Move magic to set __have_long* to the
+       beginning.  Use #if __have* instead of #if defined(__have*).
+       Minor typo fixes.
+
 2005-10-04  James E Wilson  <wilson@specifix.com>
 
        * libc/include/sys/dirent.h (_DIRENT_H_): Delete #include_next.  Add
index a95c149..59be0eb 100644 (file)
@@ -28,6 +28,20 @@ extern "C" {
 #include <limits.h>
 #endif
 
+/* Check if "long long" is 64bit wide */
+/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */
+#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \
+  || ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
+#define __have_longlong64 1
+#endif
+
+/* Check if "long" is 64bit or 32bit wide */
+#if __STDINT_EXP(LONG_MAX) > 0x7fffffff
+#define __have_long64 1
+#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff
+#define __have_long32 1
+#endif
+
 #if __STDINT_EXP(SCHAR_MAX) == 0x7f
 typedef signed char int8_t ;
 typedef unsigned char uint8_t ;
@@ -74,7 +88,6 @@ typedef unsigned int uint32_t;
 typedef signed long int32_t;
 typedef unsigned long uint32_t;
 #define __int32_t_defined 1
-#define __have_long32 1
 #elif __STDINT_EXP(SHRT_MAX) == 0x7fffffffL
 typedef signed short int32_t;
 typedef unsigned short uint32_t;
@@ -103,21 +116,14 @@ typedef uint32_t          uint_least16_t;
 #endif
 #endif
 
-#if __STDINT_EXP(LONG_MAX) > 0x7fffffff
+#if __have_long64
 typedef signed long int64_t;
 typedef unsigned long uint64_t;
 #define __int64_t_defined 1
-#define __have_long64 1
-#elif  defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff)
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#define __int64_t_defined 1
-#define __have_longlong64 1
-#elif  defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
+#elif __have_longlong64
 typedef signed long long int64_t;
 typedef unsigned long long uint64_t;
 #define __int64_t_defined 1
-#define __have_longlong64 1
 #elif  __STDINT_EXP(INT_MAX) > 0x7fffffff
 typedef signed int int64_t;
 typedef unsigned int uint64_t;
@@ -163,9 +169,9 @@ typedef uint64_t    uint_least32_t;
   typedef __UINTMAX_TYPE__ uintmax_t;
 #elif __have_longlong64
   typedef unsigned long long uintmax_t;
- #else
+#else
   typedef unsigned long uintmax_t;
- #endif
+#endif
 
 /*
  * GCC doesn't provide an appropriate macro for [u]intptr_t
@@ -232,7 +238,7 @@ typedef unsigned long uintptr_t;
 #define INT64_MIN      (-9223372036854775807L-1L)
 #define INT64_MAX       9223372036854775807L
 #define UINT64_MAX     18446744073709551615U
-#elif defined(__have_longlong64)
+#elif __have_longlong64
 #define INT64_MIN      (-9223372036854775807LL-1LL)
 #define INT64_MAX       9223372036854775807LL
 #define UINT64_MAX     18446744073709551615ULL
@@ -244,7 +250,7 @@ typedef unsigned long uintptr_t;
 #define INT_LEAST64_MIN  (-9223372036854775807L-1L)
 #define INT_LEAST64_MAX  9223372036854775807L
 #define UINT_LEAST64_MAX 18446744073709551615U
-#elif defined(__have_longlong64)
+#elif __have_longlong64
 #define INT_LEAST64_MIN  (-9223372036854775807LL-1LL)
 #define INT_LEAST64_MAX  9223372036854775807LL
 #define UINT_LEAST64_MAX 18446744073709551615ULL