1 /*-------------------------------------------------------------------------
2 stdint.h - ISO C99 7.18 Integer types <stdint.h>
4 Written By - Maarten Brock, sourceforge.brock@dse.nl (2005)
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------*/
24 /* Exact integral types. */
28 typedef signed char int8_t;
29 typedef short int int16_t;
30 typedef long int int32_t;
33 typedef unsigned char uint8_t;
34 typedef unsigned short int uint16_t;
35 typedef unsigned long int uint32_t;
41 typedef signed char int_least8_t;
42 typedef short int int_least16_t;
43 typedef long int int_least32_t;
46 typedef unsigned char uint_least8_t;
47 typedef unsigned short int uint_least16_t;
48 typedef unsigned long int uint_least32_t;
54 typedef signed char int_fast8_t;
55 typedef int int_fast16_t;
56 typedef long int int_fast32_t;
59 typedef unsigned char uint_fast8_t;
60 typedef unsigned int uint_fast16_t;
61 typedef unsigned long int uint_fast32_t;
64 /* Types for `void *' pointers. */
65 #if defined (SDCC_mcs51) || defined (SDCC_ds390)
66 typedef long int intptr_t;
67 typedef unsigned long int uintptr_t;
70 typedef unsigned int uintptr_t;
74 /* Largest integral types. */
75 typedef long int intmax_t;
76 typedef unsigned long int uintmax_t;
79 /* Limits of integral types. */
81 /* Minimum of signed integral types. */
82 # define INT8_MIN (-128)
83 # define INT16_MIN (-32767-1)
84 # define INT32_MIN (-2147483647L-1)
85 /* Maximum of signed integral types. */
86 # define INT8_MAX (127)
87 # define INT16_MAX (32767)
88 # define INT32_MAX (2147483647L)
90 /* Maximum of unsigned integral types. */
91 # define UINT8_MAX (255)
92 # define UINT16_MAX (65535)
93 # define UINT32_MAX (4294967295UL)
95 /* Minimum of signed integral types having a minimum size. */
96 # define INT_LEAST8_MIN (-128)
97 # define INT_LEAST16_MIN (-32767-1)
98 # define INT_LEAST32_MIN (-2147483647L-1)
99 /* Maximum of signed integral types having a minimum size. */
100 # define INT_LEAST8_MAX (127)
101 # define INT_LEAST16_MAX (32767)
102 # define INT_LEAST32_MAX (2147483647L)
104 /* Maximum of unsigned integral types having a minimum size. */
105 # define UINT_LEAST8_MAX (255)
106 # define UINT_LEAST16_MAX (65535)
107 # define UINT_LEAST32_MAX (4294967295UL)
109 /* Minimum of fast signed integral types having a minimum size. */
110 # define INT_FAST8_MIN (-128)
111 # define INT_FAST16_MIN (-32767-1)
112 # define INT_FAST32_MIN (-2147483647L-1)
114 /* Maximum of fast signed integral types having a minimum size. */
115 # define INT_FAST8_MAX (127)
116 # define INT_FAST16_MAX (32767)
117 # define INT_FAST32_MAX (2147483647L)
119 /* Maximum of fast unsigned integral types having a minimum size. */
120 # define UINT_FAST8_MAX (255)
121 # define UINT_FAST16_MAX (65535)
122 # define UINT_FAST32_MAX (4294967295UL)
124 /* Values to test for integral types holding `void *' pointer. */
125 #if defined (SDCC_mcs51) || defined (SDCC_ds390)
126 # define INTPTR_MIN (-2147483647L-1)
127 # define INTPTR_MAX (2147483647L)
128 # define UINTPTR_MAX (4294967295UL)
130 # define INTPTR_MIN (-32767-1)
131 # define INTPTR_MAX (32767)
132 # define UINTPTR_MAX (65535)
135 /* Minimum for largest signed integral type. */
136 # define INTMAX_MIN (-__INT32_C(-2147483647L)-1)
137 /* Maximum for largest signed integral type. */
138 # define INTMAX_MAX (__INT32_C(2147483647L))
140 /* Maximum for largest unsigned integral type. */
141 # define UINTMAX_MAX (__UINT32_C(4294967295UL))
144 /* Limits of other integer types. */
146 /* Limits of `ptrdiff_t' type. */
147 #if defined (SDCC_mcs51) || defined (SDCC_ds390)
148 # define PTRDIFF_MIN (-2147483647L-1)
149 # define PTRDIFF_MAX (2147483647L)
151 # define PTRDIFF_MIN (-32767-1)
152 # define PTRDIFF_MAX (32767)
155 /* Limit of `size_t' type. */
156 # define SIZE_MAX (65535)
160 # define INT16_C(c) c
161 # define INT32_C(c) c ## L
164 # define UINT8_C(c) c ## U
165 # define UINT16_C(c) c ## U
166 # define UINT32_C(c) c ## UL
169 # define INTMAX_C(c) c ## L
170 # define UINTMAX_C(c) c ## UL
173 #endif /* stdint.h */