summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2005-10-04 21:02:59 +0000
committerJeff Johnston <jjohnstn@redhat.com>2005-10-04 21:02:59 +0000
commitc7e209797c981ff01197ef5007e5e1be952dbb6e (patch)
tree214b3fab26d042fee785f9244393a286333e6bc0
parent58e78add8bc0082c64a05f64c91bb4e0e6ec6c40 (diff)
downloadcygnal-c7e209797c981ff01197ef5007e5e1be952dbb6e.tar.gz
cygnal-c7e209797c981ff01197ef5007e5e1be952dbb6e.tar.bz2
cygnal-c7e209797c981ff01197ef5007e5e1be952dbb6e.zip
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.
-rw-r--r--newlib/ChangeLog6
-rw-r--r--newlib/libc/include/stdint.h34
2 files changed, 26 insertions, 14 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index f2a259b03..90ed463ac 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -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
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h
index a95c149a2..59be0eb6c 100644
--- a/newlib/libc/include/stdint.h
+++ b/newlib/libc/include/stdint.h
@@ -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