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 typedef long int intptr_t;
66 typedef unsigned long int uintptr_t;
69 /* Largest integral types. */
70 typedef long int intmax_t;
71 typedef unsigned long int uintmax_t;
74 /* Limits of integral types. */
76 /* Minimum of signed integral types. */
77 # define INT8_MIN (-128)
78 # define INT16_MIN (-32767-1)
79 # define INT32_MIN (-2147483647L-1)
80 /* Maximum of signed integral types. */
81 # define INT8_MAX (127)
82 # define INT16_MAX (32767)
83 # define INT32_MAX (2147483647L)
85 /* Maximum of unsigned integral types. */
86 # define UINT8_MAX (255)
87 # define UINT16_MAX (65535)
88 # define UINT32_MAX (4294967295UL)
90 /* Minimum of signed integral types having a minimum size. */
91 # define INT_LEAST8_MIN (-128)
92 # define INT_LEAST16_MIN (-32767-1)
93 # define INT_LEAST32_MIN (-2147483647L-1)
94 /* Maximum of signed integral types having a minimum size. */
95 # define INT_LEAST8_MAX (127)
96 # define INT_LEAST16_MAX (32767)
97 # define INT_LEAST32_MAX (2147483647L)
99 /* Maximum of unsigned integral types having a minimum size. */
100 # define UINT_LEAST8_MAX (255)
101 # define UINT_LEAST16_MAX (65535)
102 # define UINT_LEAST32_MAX (4294967295UL)
104 /* Minimum of fast signed integral types having a minimum size. */
105 # define INT_FAST8_MIN (-128)
106 # define INT_FAST16_MIN (-32767-1)
107 # define INT_FAST32_MIN (-2147483647L-1)
109 /* Maximum of fast signed integral types having a minimum size. */
110 # define INT_FAST8_MAX (127)
111 # define INT_FAST16_MAX (32767)
112 # define INT_FAST32_MAX (2147483647L)
114 /* Maximum of fast unsigned integral types having a minimum size. */
115 # define UINT_FAST8_MAX (255)
116 # define UINT_FAST16_MAX (65535)
117 # define UINT_FAST32_MAX (4294967295UL)
119 /* Values to test for integral types holding `void *' pointer. */
120 # define INTPTR_MIN (-2147483647L-1)
121 # define INTPTR_MAX (2147483647L)
122 # define UINTPTR_MAX (4294967295UL)
124 /* Minimum for largest signed integral type. */
125 # define INTMAX_MIN (-__INT32_C(-2147483647L)-1)
126 /* Maximum for largest signed integral type. */
127 # define INTMAX_MAX (__INT32_C(2147483647L))
129 /* Maximum for largest unsigned integral type. */
130 # define UINTMAX_MAX (__UINT32_C(4294967295UL))
133 /* Limits of other integer types. */
135 /* Limits of `ptrdiff_t' type. */
136 # define PTRDIFF_MIN (-2147483647L-1)
137 # define PTRDIFF_MAX (2147483647L)
139 /* Limit of `size_t' type. */
140 # define SIZE_MAX (65535)
144 # define INT16_C(c) c
145 # define INT32_C(c) c ## L
148 # define UINT8_C(c) c ## U
149 # define UINT16_C(c) c ## U
150 # define UINT32_C(c) c ## UL
153 # define INTMAX_C(c) c ## L
154 # define UINTMAX_C(c) c ## UL
157 #endif /* stdint.h */