Imported Upstream version 2.9.0
[debian/cc1111] / device / include / stdint.h
1 /*-------------------------------------------------------------------------
2   stdint.h - ISO C99 7.18 Integer types <stdint.h>
3
4              Written By -  Maarten Brock, sourceforge.brock@dse.nl (2005)
5
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.
10
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.
15
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 -------------------------------------------------------------------------*/
20
21 #ifndef _STDINT_H
22 #define _STDINT_H       1
23
24 /* Exact integral types.  */
25
26 /* Signed.  */
27
28 typedef signed char             int8_t;
29 typedef short int               int16_t;
30 typedef long int                int32_t;
31
32 /* Unsigned.  */
33 typedef unsigned char           uint8_t;
34 typedef unsigned short int      uint16_t;
35 typedef unsigned long int       uint32_t;
36
37
38 /* Small types.  */
39
40 /* Signed.  */
41 typedef signed char             int_least8_t;
42 typedef short int               int_least16_t;
43 typedef long int                int_least32_t;
44
45 /* Unsigned.  */
46 typedef unsigned char           uint_least8_t;
47 typedef unsigned short int      uint_least16_t;
48 typedef unsigned long int       uint_least32_t;
49
50
51 /* Fast types.  */
52
53 /* Signed.  */
54 typedef signed char             int_fast8_t;
55 typedef int                     int_fast16_t;
56 typedef long int                int_fast32_t;
57
58 /* Unsigned.  */
59 typedef unsigned char           uint_fast8_t;
60 typedef unsigned int            uint_fast16_t;
61 typedef unsigned long int       uint_fast32_t;
62
63
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;
68 #else
69   typedef int                   intptr_t;
70   typedef unsigned int          uintptr_t;
71 #endif
72
73
74 /* Largest integral types.  */
75 typedef long int                intmax_t;
76 typedef unsigned long int       uintmax_t;
77
78
79 /* Limits of integral types.  */
80
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)
89
90 /* Maximum of unsigned integral types.  */
91 # define UINT8_MAX              (255)
92 # define UINT16_MAX             (65535)
93 # define UINT32_MAX             (4294967295UL)
94
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)
103
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)
108
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)
113
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)
118
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)
123
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)
129 #else
130 # define INTPTR_MIN             (-32767-1)
131 # define INTPTR_MAX             (32767)
132 # define UINTPTR_MAX            (65535)
133 #endif
134
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))
139
140 /* Maximum for largest unsigned integral type.  */
141 # define UINTMAX_MAX            (__UINT32_C(4294967295UL))
142
143
144 /* Limits of other integer types.  */
145
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)
150 #else
151 # define PTRDIFF_MIN           (-32767-1)
152 # define PTRDIFF_MAX           (32767)
153 #endif
154
155 /* Limit of `size_t' type.  */
156 # define SIZE_MAX               (65535)
157
158 /* Signed.  */
159 # define INT8_C(c)      c
160 # define INT16_C(c)     c
161 # define INT32_C(c)     c ## L
162
163 /* Unsigned.  */
164 # define UINT8_C(c)     c ## U
165 # define UINT16_C(c)    c ## U
166 # define UINT32_C(c)    c ## UL
167
168 /* Maximal type.  */
169 # define INTMAX_C(c)    c ## L
170 # define UINTMAX_C(c)   c ## UL
171
172
173 #endif /* stdint.h */