provide SIZE_MAX
[AROS.git] / compiler / stdc / include / aros / stdc / stdint.h
blob86630050e19af3673dde4c5889760d20afe7c3af
1 #ifndef _STDC_STDINT_H_
2 #define _STDC_STDINT_H_
4 /*
5 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: C99 header file stdint.h
9 Standard fixed sized integral types.
12 #include <aros/cpu.h>
14 #include <aros/types/int_t.h>
16 #include <aros/types/intptr_t.h>
17 #include <aros/types/uintptr_t.h>
20 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
22 #define INT8_MIN (-128)
23 #define INT16_MIN (-32767-1)
24 #define INT32_MIN (-2147483647-1)
25 #define INT64_MIN (-AROS_MAKE_INT64(9223372036854775807)-1)
27 #define INT8_MAX (127)
28 #define INT16_MAX (32767)
29 #define INT32_MAX (2147483647)
30 #define INT64_MAX (AROS_MAKE_INT64(9223372036854775807))
32 #define UINT8_MAX (255)
33 #define UINT16_MAX (65535)
34 #define UINT32_MAX (4294967295U)
35 #define UINT64_MAX (AROS_MAKE_UINT64(18446744073709551615))
37 #define SIG_ATOMIC_MIN AROS_SIG_ATOMIC_MIN
38 #define SIG_ATOMIC_MAX AROS_SIG_ATOMIC_MAX
40 #define INT_LEAST8_MIN (-128)
41 #define INT_LEAST16_MIN (-32767-1)
42 #define INT_LEAST32_MIN (-2147483647-1)
43 #define INT_LEAST64_MIN (-AROS_MAKE_INT64(9223372036854775807)-1)
45 #define INT_LEAST8_MAX (127)
46 #define INT_LEAST16_MAX (32767)
47 #define INT_LEAST32_MAX (2147483647)
48 #define INT_LEAST64_MAX (AROS_MAKE_INT64(9223372036854775807))
50 #define UINT_LEAST8_MAX (255)
51 #define UINT_LEAST16_MAX (65535)
52 #define UINT_LEAST32_MAX (4294967295U)
53 #define UINT_LEAST64_MAX (AROS_MAKE_UINT64(18446744073709551615))
56 #define INT_FAST8_MIN (-128)
57 #define INT_FAST16_MIN (-32767-1)
58 #define INT_FAST32_MIN (-2147483647-1)
59 #define INT_FAST64_MIN (-AROS_MAKE_INT64(9223372036854775807)-1)
61 #define INT_FAST8_MAX (127)
62 #define INT_FAST16_MAX (32767)
63 #define INT_FAST32_MAX (2147483647)
64 #define INT_FAST64_MAX (AROS_MAKE_INT64(9223372036854775807))
66 #define UINT_FAST8_MAX (255)
67 #define UINT_FAST16_MAX (65535)
68 #define UINT_FAST32_MAX (4294967295U)
69 #define UINT_FAST64_MAX (AROS_MAKE_UINT64(18446744073709551615))
72 #if __WORDSIZE == 64
73 #define INTPTR_MIN (-AROS_MAKE_INT64(9223372036854775807)-1)
74 #define INTPTR_MAX (AROS_MAKE_INT64(9223372036854775807))
75 #define UINTPTR_MAX (AROS_MAKE_UINT64(18446744073709551615))
76 #else
77 #define INTPTR_MIN (-2147483647-1)
78 #define INTPTR_MAX (2147483647)
79 #define UINTPTR_MAX (4294967295U)
80 #endif
82 #ifndef SIZE_MAX
83 # if __WORDSIZE == 64
84 # define SIZE_MAX UINT64_MAX
85 # else
86 # define SIZE_MAX UINT32_MAX
87 # endif
88 #endif
90 /* TODO:
91 PTRDIFF_MIN, _MAX
92 WCHAR_MIN, _MAX (must be <= -127 or >= 127)
93 WINT_MIN, _MAX (must be <= -65535 or >= 65535)
96 #endif
99 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
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
137 #endif /* !__cplusplus || __STDC_CONSTANT_MACROS */
139 #endif /* _STDC_STDINT_H_ */