aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/include
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 /newlib/libc/include
parent51c8a2133a57aaf8fdf7bee04df12cb08f8b76bd (diff)
downloadnewlib-bc037f3a51648667cd368e511a24f8a11eaa9be9.zip
newlib-bc037f3a51648667cd368e511a24f8a11eaa9be9.tar.gz
newlib-bc037f3a51648667cd368e511a24f8a11eaa9be9.tar.bz2
2005-10-06 Ralf Corsepius <ralf.corsepius@rtems.org>
* libc/include/stdint.h: Add [u]int_fast<N>_t types.
Diffstat (limited to 'newlib/libc/include')
-rw-r--r--newlib/libc/include/stdint.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h
index 59be0eb..29bb8c5 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)