summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2005-10-06 19:46:21 +0000
committerJeff Johnston <jjohnstn@redhat.com>2005-10-06 19:46:21 +0000
commitbc037f3a51648667cd368e511a24f8a11eaa9be9 (patch)
treef57932e15a4119d3ead939d1d5ee0b9cf0252b52
parent51c8a2133a57aaf8fdf7bee04df12cb08f8b76bd (diff)
downloadcygnal-bc037f3a51648667cd368e511a24f8a11eaa9be9.tar.gz
cygnal-bc037f3a51648667cd368e511a24f8a11eaa9be9.tar.bz2
cygnal-bc037f3a51648667cd368e511a24f8a11eaa9be9.zip
2005-10-06 Ralf Corsepius <ralf.corsepius@rtems.org>
* libc/include/stdint.h: Add [u]int_fast<N>_t types.
-rw-r--r--newlib/ChangeLog4
-rw-r--r--newlib/libc/include/stdint.h91
2 files changed, 95 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 90ed463ac..47ebb843e 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,7 @@
+2005-10-06 Ralf Corsepius <ralf.corsepius@rtems.org>
+
+ * libc/include/stdint.h: Add [u]int_fast<N>_t types.
+
2005-10-04 Ralf Corsepius <ralf.corsepius@rtems.org>
* libc/include/stdint.h: Move magic to set __have_long* to the
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h
index 59be0eb6c..29bb8c5f8 100644
--- a/newlib/libc/include/stdint.h
+++ b/newlib/libc/include/stdint.h
@@ -154,6 +154,73 @@ typedef uint64_t uint_least32_t;
#endif
#endif
+/*
+ * Fastest minimum-width integer types
+ *
+ * Assume int to be the fastest type for all types with a width
+ * less than __INT_MAX__ rsp. INT_MAX
+ */
+#if __STDINT_EXP(INT_MAX) >= 0x7f
+ typedef signed int int_fast8_t;
+ typedef unsigned int uint_fast8_t;
+#define __int_fast8_t_defined 1
+#endif
+
+#if __STDINT_EXP(INT_MAX) >= 0x7fff
+ typedef signed int int_fast16_t;
+ typedef unsigned int uint_fast16_t;
+#define __int_fast16_t_defined 1
+#endif
+
+#if __STDINT_EXP(INT_MAX) >= 0x7fffffff
+ typedef signed int int_fast32_t;
+ typedef unsigned int uint_fast32_t;
+#define __int_fast32_t_defined 1
+#endif
+
+#if __STDINT_EXP(INT_MAX) > 0x7fffffff
+ typedef signed int int_fast64_t;
+ typedef unsigned int uint_fast64_t;
+#define __int_fast64_t_defined 1
+#endif
+
+/*
+ * Fall back to [u]int_least<N>_t for [u]int_fast<N>_t types
+ * not having been defined, yet.
+ * Leave undefined, if [u]int_least<N>_t should not be available.
+ */
+#if !__int_fast8_t_defined
+#if __int_least8_t_defined
+ typedef int_least8_t int_fast8_t;
+ typedef uint_least8_t uint_fast8_t;
+#define __int_fast8_t_defined 1
+#endif
+#endif
+
+#if !__int_fast16_t_defined
+#if __int_least16_t_defined
+ typedef int_least16_t int_fast16_t;
+ typedef uint_least16_t uint_fast16_t;
+#define __int_fast16_t_defined 1
+#endif
+#endif
+
+#if !__int_fast32_t_defined
+#if __int_least32_t_defined
+ typedef int_least32_t int_fast32_t;
+ typedef uint_least32_t uint_fast32_t;
+#define __int_fast32_t_defined 1
+#endif
+#endif
+
+#if !__int_fast64_t_defined
+#if __int_least64_t_defined
+ typedef int_least64_t int_fast64_t;
+ typedef uint_least64_t uint_fast64_t;
+#define __int_fast64_t_defined 1
+#endif
+#endif
+
/* Greatest-width integer types */
/* Modern GCCs provide __INTMAX_TYPE__ */
#if defined(__INTMAX_TYPE__)
@@ -257,6 +324,30 @@ typedef unsigned long uintptr_t;
#endif
#endif
+#if __int_fast8_t_defined
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST8_MAX INT8_MAX
+#define UINT_FAST8_MAX UINT8_MAX
+#endif
+
+#if __int_fast16_t_defined
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST16_MAX INT16_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+#endif
+
+#if __int_fast32_t_defined
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+#endif
+
+#if __int_fast64_t_defined
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+#endif
+
/* This must match size_t in stddef.h, currently long unsigned int */
#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
#define SIZE_MAX __STDINT_EXP(LONG_MAX)