|
@@ -1,120 +1,80 @@
|
|
|
/*
|
|
|
- <stdint.h> -- simple version used by "gimplify"
|
|
|
+ * stdint.h - standard types
|
|
|
+ */
|
|
|
+/* $Id$ */
|
|
|
|
|
|
- last edit: 2007-03-02 D A Gwyn
|
|
|
-*/
|
|
|
+#ifndef _STDINT_H
|
|
|
+#define _STDINT_H
|
|
|
|
|
|
-/* Although we try to unify integer types, some actual machine characteristics
|
|
|
- are visible, and these definitions need to work within their limits. We do
|
|
|
- assume that the GCC target has an "int" at least 32 bits wide, which works
|
|
|
- for all our development platforms. We use "long long" for the widest types
|
|
|
- because presumably the programmer really needed something special there. */
|
|
|
-
|
|
|
-#define int8_t signed char
|
|
|
-#define uint8_t unsigned char
|
|
|
-#define int16_t short
|
|
|
-#define uint16_t unsigned short
|
|
|
-#define int32_t int
|
|
|
-#define uint32_t unsigned
|
|
|
-#define int64_t long long
|
|
|
-#define uint64_t unsigned long long
|
|
|
-
|
|
|
-#define int_least8_t int
|
|
|
-#define uint_least8_t int
|
|
|
-#define int_least16_t int
|
|
|
-#define uint_least16_t unsigned
|
|
|
-#define int_least32_t int
|
|
|
-#define uint_least32_t unsigned
|
|
|
-#define int_least64_t long long
|
|
|
-#define uint_least64_t unsigned long long
|
|
|
-
|
|
|
-#define intptr_t int
|
|
|
-#define uintptr_t unsigned int
|
|
|
-
|
|
|
-#define intmax_t long long
|
|
|
-#define uintmax_t unsigned long long
|
|
|
-
|
|
|
-#define int_fast8_t int
|
|
|
-#define uint_fast8_t unsigned int
|
|
|
-#define int_fast16_t int
|
|
|
-#define uint_fast16_t unsigned int
|
|
|
-#define int_fast32_t int
|
|
|
-#define uint_fast32_t unsigned int
|
|
|
-#define int_fast64_t long long int
|
|
|
-#define uint_fast64_t unsigned long long
|
|
|
+/* int8_t is always a char, on all ACK platforms. */
|
|
|
|
|
|
+typedef signed char int8_t;
|
|
|
+typedef unsigned char uint8_t;
|
|
|
#define INT8_MAX 127
|
|
|
#define INT8_MIN (-128)
|
|
|
#define UINT8_MAX 255
|
|
|
|
|
|
+/* int16_t is always a short, on all ACK platforms. */
|
|
|
+
|
|
|
+typedef signed short int16_t;
|
|
|
+typedef unsigned short uint16_t;
|
|
|
#define INT16_MAX 32767
|
|
|
#define INT16_MIN (-32768)
|
|
|
#define UINT16_MAX 65535
|
|
|
|
|
|
+/* int32_t is either a int or a long. */
|
|
|
+
|
|
|
+#if _EM_WSIZE == 4
|
|
|
+typedef signed int int32_t;
|
|
|
+typedef unsigned short uint32_t;
|
|
|
+#else
|
|
|
+typedef signed long int32_t;
|
|
|
+typedef unsigned long uint32_t;
|
|
|
+#endif
|
|
|
#define INT32_MAX 2147483647
|
|
|
#define INT32_MIN (-2147483648)
|
|
|
#define UINT32_MAX 4294967295
|
|
|
|
|
|
+/* We only get int64_t if longs are 8 bytes. */
|
|
|
+
|
|
|
+#if _EM_LSIZE == 8
|
|
|
+typedef signed long int64_t;
|
|
|
+typedef unsigned long uint64_t;
|
|
|
#define INT64_MAX 2147483647LL
|
|
|
#define INT64_MIN (-2147483648LL)
|
|
|
#define UINT64_MAX 4294967295ULL
|
|
|
|
|
|
-#define INT_LEAST8_MAX 2147483647
|
|
|
-#define INT_LEAST8_MIN (-2147483647)
|
|
|
-#define UINT_LEAST8_MAX 4294967295
|
|
|
-
|
|
|
-#define INT_LEAST16_MAX 2147483647
|
|
|
-#define INT_LEAST16_MIN (-2147483647)
|
|
|
-#define UINT_LEAST16_MAX 4294967295
|
|
|
-
|
|
|
-#define INT_LEAST32_MAX 2147483647
|
|
|
-#define INT_LEAST32_MIN (-2147483647)
|
|
|
-#define UINT_LEAST32_MAX 4294967295
|
|
|
-
|
|
|
-#define INT_LEAST64_MAX 2147483647LL
|
|
|
-#define INT_LEAST64_MIN (-2147483647LL)
|
|
|
-#define UINT_LEAST64_MAX 4294967295ULL
|
|
|
-
|
|
|
-#define INT_FAST8_MAX 2147483647
|
|
|
-#define INT_FAST8_MIN (-2147483647)
|
|
|
-#define UINT_FAST8_MAX 4294967295
|
|
|
-
|
|
|
-#define INT_FAST16_MAX 2147483647
|
|
|
-#define INT_FAST16_MIN (-2147483647)
|
|
|
-#define UINT_FAST16_MAX 4294967295
|
|
|
-
|
|
|
-#define INT_FAST32_MAX 2147483647
|
|
|
-#define INT_FAST32_MIN (-2147483647)
|
|
|
-#define UINT_FAST32_MAX 4294967295
|
|
|
-
|
|
|
-#define INT_FAST64_MAX 2147483647LL
|
|
|
-#define INT_FAST64_MIN (-2147483647LL)
|
|
|
-#define UINT_FAST64_MAX 4294967295ULL
|
|
|
-
|
|
|
+typedef int64_t intmax_t;
|
|
|
+typedef uint64_t uintmax_t;
|
|
|
+#else
|
|
|
+typedef int32_t intmax_t;
|
|
|
+typedef uint32_t uintmax_t;
|
|
|
+#endif
|
|
|
+
|
|
|
+/* Pointers can be either 16 or 32 bits. */
|
|
|
+
|
|
|
+#if _EM_PSIZE == 2
|
|
|
+typedef int16_t intptr_t;
|
|
|
+typedef uint16_t uintptr_t;
|
|
|
+typedef int16_t ptrdiff_t;
|
|
|
+typedef uint16_t size_t;
|
|
|
+#define INTPTR_MAX 32767
|
|
|
+#define INTPTR_MIN (-32768)
|
|
|
+#define UINTPTR_MAX 65535
|
|
|
+#else
|
|
|
+typedef int32_t intptr_t;
|
|
|
+typedef uint32_t uintptr_t;
|
|
|
+typedef int32_t ptrdiff_t;
|
|
|
+typedef uint32_t size_t;
|
|
|
#define INTPTR_MAX 2147483647
|
|
|
#define INTPTR_MIN (-2147483647)
|
|
|
#define UINTPTR_MAX 4294967295
|
|
|
+#endif
|
|
|
|
|
|
-#define INTMAX_MAX 2147483647LL
|
|
|
-#define INTMAX_MIN (-2147483647LL)
|
|
|
-#define UINTMAX_MAX 4294967295ULL
|
|
|
-
|
|
|
-#define PTRDIFF_MAX 2147483647
|
|
|
-#define PTRDIFF_MIN (-2147483647)
|
|
|
-
|
|
|
-#define SIG_ATOMIC_MAX 4294967295
|
|
|
-#define SIG_ATOMIC_MIN 0
|
|
|
+/* Now those have been defined, these are always the same. */
|
|
|
|
|
|
-#define SIZE_MAX 4294967295
|
|
|
+#define PTRDIFF_MAX INTPTR_MAX
|
|
|
+#define PTRDIFF_MIN INTPTR_MIN
|
|
|
+#define SIZE_MAX UINTPTR_MAX
|
|
|
|
|
|
-/* The trick used to get the right type is due to Clive Feather: */
|
|
|
-#define INT8_C(c) (INT_LEAST8_MAX - INT_LEAST8_MAX + (c))
|
|
|
-#define UINT8_C(c) (UINT_LEAST8_MAX - UINT_LEAST8_MAX + (c))
|
|
|
-#define INT16_C(c) (INT_LEAST16_MAX - INT_LEAST16_MAX + (c))
|
|
|
-#define UINT16_C(c) (UINT_LEAST16_MAX - UINT_LEAST16_MAX + (c))
|
|
|
-#define INT32_C(c) (INT_LEAST32_MAX - INT_LEAST32_MAX + (c))
|
|
|
-#define UINT32_C(c) (UINT_LEAST32_MAX - UINT_LEAST32_MAX + (c))
|
|
|
-#define INT64_C(c) (INT_LEAST64_MAX - INT_LEAST64_MAX + (c))
|
|
|
-#define UINT64_C(c) (UINT_LEAST64_MAX - UINT_LEAST64_MAX + (c))
|
|
|
-#define INTMAX_C(c) (INTMAX_MAX - INTMAX_MAX + (c))
|
|
|
-#define UINTMAX_C(c) (UINTMAX_MAX - UINTMAX_MAX + (c))
|
|
|
+#endif
|