fix limits.h c++ usage of stdint.h
[AROS.git] / compiler / stdc / include / aros / stdc / stdint.h
blob63144c152d353645b00047a9edc4dbfe86330854
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: C99 header file stdint.h
6 Standard fixed sized integral types.
7 */
9 #include <aros/cpu.h>
11 #include <aros/types/int_t.h>
13 #include <aros/types/intptr_t.h>
14 #include <aros/types/uintptr_t.h>
17 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
18 #ifndef _STDC_STDINT_H_LIMITMACROS
19 #define _STDC_STDINT_H_LIMITMACROS
20 #define INT8_MIN (-128)
21 #define INT16_MIN (-32767-1)
22 #define INT32_MIN (-2147483647-1)
23 #define INT64_MIN (-AROS_MAKE_INT64(9223372036854775807)-1)
25 #define INT8_MAX (127)
26 #define INT16_MAX (32767)
27 #define INT32_MAX (2147483647)
28 #define INT64_MAX (AROS_MAKE_INT64(9223372036854775807))
30 #define UINT8_MAX (255)
31 #define UINT16_MAX (65535)
32 #define UINT32_MAX (4294967295U)
33 #define UINT64_MAX (AROS_MAKE_UINT64(18446744073709551615))
35 #define SIG_ATOMIC_MIN AROS_SIG_ATOMIC_MIN
36 #define SIG_ATOMIC_MAX AROS_SIG_ATOMIC_MAX
38 #define INT_LEAST8_MIN (-128)
39 #define INT_LEAST16_MIN (-32767-1)
40 #define INT_LEAST32_MIN (-2147483647-1)
41 #define INT_LEAST64_MIN (-AROS_MAKE_INT64(9223372036854775807)-1)
43 #define INT_LEAST8_MAX (127)
44 #define INT_LEAST16_MAX (32767)
45 #define INT_LEAST32_MAX (2147483647)
46 #define INT_LEAST64_MAX (AROS_MAKE_INT64(9223372036854775807))
48 #define UINT_LEAST8_MAX (255)
49 #define UINT_LEAST16_MAX (65535)
50 #define UINT_LEAST32_MAX (4294967295U)
51 #define UINT_LEAST64_MAX (AROS_MAKE_UINT64(18446744073709551615))
54 #define INT_FAST8_MIN (-128)
55 #define INT_FAST16_MIN (-32767-1)
56 #define INT_FAST32_MIN (-2147483647-1)
57 #define INT_FAST64_MIN (-AROS_MAKE_INT64(9223372036854775807)-1)
59 #define INT_FAST8_MAX (127)
60 #define INT_FAST16_MAX (32767)
61 #define INT_FAST32_MAX (2147483647)
62 #define INT_FAST64_MAX (AROS_MAKE_INT64(9223372036854775807))
64 #define UINT_FAST8_MAX (255)
65 #define UINT_FAST16_MAX (65535)
66 #define UINT_FAST32_MAX (4294967295U)
67 #define UINT_FAST64_MAX (AROS_MAKE_UINT64(18446744073709551615))
70 #if __WORDSIZE == 64
71 #define INTPTR_MIN (-AROS_MAKE_INT64(9223372036854775807)-1)
72 #define INTPTR_MAX (AROS_MAKE_INT64(9223372036854775807))
73 #define UINTPTR_MAX (AROS_MAKE_UINT64(18446744073709551615))
74 #else
75 #define INTPTR_MIN (-2147483647-1)
76 #define INTPTR_MAX (2147483647)
77 #define UINTPTR_MAX (4294967295U)
78 #endif
80 #ifndef SIZE_MAX
81 # if __WORDSIZE == 64
82 # define SIZE_MAX UINT64_MAX
83 # else
84 # define SIZE_MAX UINT32_MAX
85 # endif
86 #endif
88 /* TODO:
89 PTRDIFF_MIN, _MAX
90 WCHAR_MIN, _MAX (must be <= -127 or >= 127)
91 WINT_MIN, _MAX (must be <= -65535 or >= 65535)
94 #endif
96 #endif /* _STDC_STDINT_H_LIMITMACROS */
97 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
98 #ifndef _STDC_STDINT_H_CONSTMACROS
99 #define _STDC_STDINT_H_CONSTMACROS
101 /* Signed. */
102 # define INT8_C(c) c
103 # define INT16_C(c) c
104 # define INT32_C(c) c
105 # if __WORDSIZE == 64
106 # define INT64_C(c) c ## L
107 # else
108 # define INT64_C(c) c ## LL
109 # endif
111 /* Unsigned. */
112 # define UINT8_C(c) c
113 # define UINT16_C(c) c
114 # define UINT32_C(c) c ## U
115 # if __WORDSIZE == 64
116 # define UINT64_C(c) c ## UL
117 # else
118 # define UINT64_C(c) c ## ULL
119 # endif
121 /* Maximal type. */
122 # if __WORDSIZE == 64
123 # define INTMAX_C(c) c ## L
124 # define UINTMAX_C(c) c ## UL
125 # else
126 # define INTMAX_C(c) c ## LL
127 # define UINTMAX_C(c) c ## ULL
128 # endif
130 /* Maximal integer (long long) size */
131 # define INTMAX_MIN INT64_MIN
132 # define INTMAX_MAX INT64_MAX
134 /* Maximal unsigned integer (unsigned long long) size */
135 # define UINTMAX_MAX UINT64_MAX
136 #endif /* #endif /* _STDC_STDINT_H_CONSTMACROS */ */
137 #endif /* !__cplusplus || __STDC_CONSTANT_MACROS */