This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Add fast<N>_t types to stdint.h


Hi,

the patch below adds fastN_t support to stdint.h

Ralf

2005-09-22  Ralf Corsepius <ralf.corsepius@rtems.org>

	* libc/include/stdint.h: Add fast<N>_t and [U]INT_FAST<N>_{MIN|MAX}.

Index: newlib/libc/include/stdint.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v
retrieving revision 1.3
diff -u -r1.3 stdint.h
--- newlib/libc/include/stdint.h	20 Sep 2005 21:21:51 -0000	1.3
+++ newlib/libc/include/stdint.h	21 Sep 2005 16:19:13 -0000
@@ -146,6 +148,29 @@
 #endif
 #endif
 
+/* Fastest minimum-width integer types */
+#ifdef __int8_t_defined
+typedef int8_t		int_fast8_t;
+typedef uint8_t		uint_fast8_t;
+#endif
+
+#ifdef __int16_t_defined
+typedef int16_t		int_fast16_t;
+typedef uint16_t	uint_fast16_t;
+#endif
+
+#ifdef __int32_t_defined
+typedef int32_t		int_fast32_t;
+typedef uint32_t	uint_fast32_t;
+#endif
+
+#ifdef __int64_t_defined
+typedef int64_t		int_fast64_t;
+typedef uint64_t	uint_fast64_t;
+#endif
+
+
+/* Greatest-width integer types */
 #if __have_longlong64
 typedef signed long long intmax_t;
 typedef unsigned long long uintmax_t;
@@ -154,8 +179,9 @@
 typedef unsigned long uintmax_t;
 #endif
 
+
 /*
- * GCC doesn't provide an propriate macro for [u]intptr_t
+ * GCC doesn't provide an appropriate macro for [u]intptr_t
  * For now, use __PTRDIFF_TYPE__
  */
 #if defined(__PTRDIFF_TYPE__)
@@ -238,6 +264,30 @@
 #endif
 #endif
 
+#ifdef __int8_t_defined
+#define INT_FAST8_MIN	INT8_MIN
+#define INT_FAST8_MAX	INT8_MAX
+#define UINT_FAST8_MAX	UINT8_MAX
+#endif
+
+#ifdef __int16_t_defined
+#define INT_FAST16_MIN	INT16_MIN
+#define INT_FAST16_MAX	INT16_MAX
+#define UINT_FAST16_MAX	UINT16_MAX
+#endif
+
+#ifdef __int32_t_defined
+#define INT_FAST32_MIN	INT32_MIN
+#define INT_FAST32_MAX	INT32_MAX
+#define UINT_FAST32_MAX	UINT32_MAX
+#endif
+
+#ifdef __int64_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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]