]> pd.if.org Git - pdclib/blob - stdint.h
Added the remaining function defs.
[pdclib] / stdint.h
1 /* $Id$ */
2
3 /* Release $Name$ */
4
5 /* 7.18 Integer types <stdint.h>
6
7    This file is part of the Public Domain C Library (PDCLib).
8    Permission is granted to use, modify, and / or redistribute at will.
9 */
10
11 #ifndef _PDCLIB_STDINT_H
12 #define _PDCLIB_STDINT_H _PDCLIB_STDINT_H
13
14 #ifndef _PDCLIB_INT_H
15 #define _PDCLIB_INT_H _PDCLIB_INT_H
16 #include <_PDCLIB_int.h>
17 #endif
18
19 /* 7.18.1.1 Exact-width integer types. */
20
21 typedef _PDCLIB_int8_t  int8_t;
22 typedef _PDCLIB_int16_t int16_t;
23 typedef _PDCLIB_int32_t int32_t;
24 typedef _PDCLIB_int64_t int64_t;
25
26 typedef _PDCLIB_uint8_t  uint8_t;
27 typedef _PDCLIB_uint16_t uint16_t;
28 typedef _PDCLIB_uint32_t uint32_t;
29 typedef _PDCLIB_uint64_t uint64_t;
30
31 /* 7.18.1.2 Minimum-width integer types */
32
33 /* You are allowed to add more types here, e.g. int_least24_t. For the standard
34    types, int_leastN_t is equivalent to the corresponding exact type intN_t by
35    definition.
36 */
37
38 typedef int8_t  int_least8_t;
39 typedef int16_t int_least16_t;
40 typedef int32_t int_least32_t;
41 typedef int64_t int_least64_t;
42
43 typedef uint8_t  uint_least8_t;
44 typedef uint16_t uint_least16_t;
45 typedef uint32_t uint_least32_t;
46 typedef uint64_t uint_least64_t;
47
48 /* 7.18.1.3 Fastest minimum-width integer types */
49
50 /* You are allowed to add more types here, e.g. int_fast24_t. */
51
52 typedef _PDCLIB_int_fast8_t  int_fast8_t;
53 typedef _PDCLIB_int_fast16_t int_fast16_t;
54 typedef _PDCLIB_int_fast32_t int_fast32_t;
55 typedef _PDCLIB_int_fast64_t int_fast64_t;
56
57 typedef _PDCLIB_uint_fast8_t  uint_fast8_t;
58 typedef _PDCLIB_uint_fast16_t uint_fast16_t;
59 typedef _PDCLIB_uint_fast32_t uint_fast32_t;
60 typedef _PDCLIB_uint_fast64_t uint_fast64_t;
61
62 /* 7.18.1.4 Integer types capable of holding object pointers */
63
64 typedef _PDCLIB_intptr_t  intptr_t;
65 typedef _PDCLIB_uintptr_t uintptr_t;
66
67 /* 7.18.1.5 Greatest-width integer types */
68
69 typedef _PDCLIB_intmax_t  intmax_t;
70 typedef _PDCLIB_uintmax_t uintmax_t;
71
72 /* 7.18.2 Limits of specified-width integer types */
73
74 #ifdef __cplusplus
75 #ifndef __STDC_LIMIT_MACROS
76 #define _PDCLIB_NO_LIMIT_MACROS
77 #endif
78 #endif
79
80 #ifndef _PDCLIB_NO_LIMIT_MACROS
81
82 /* 7.18.2.1 Limits of exact-width integer types */
83
84 #define INT8_MIN  _PDCLIB_INT8_MIN
85 #define INT8_MAX  _PDCLIB_INT8_MAX
86 #define UINT8_MAX _PDCLIB_UINT8_MAX
87
88 #define INT16_MIN  _PDCLIB_INT16_MIN
89 #define INT16_MAX  _PDCLIB_INT16_MAX
90 #define UINT16_MAX _PDCLIB_UINT16_MAX
91
92 #define INT32_MIN  _PDCLIB_INT32_MIN
93 #define INT32_MAX  _PDCLIB_INT32_MAX
94 #define UINT32_MAX _PDCLIB_UINT32_MAX
95
96 #define INT64_MIN  _PDCLIB_INT64_MIN
97 #define INT64_MAX  _PDCLIB_INT64_MAX
98 #define UINT64_MAX _PDCLIB_UINT64_MAX
99
100 /* 7.18.2.2 Limits of minimum-width integer types */
101
102 /* For the standard widths, least and exact types are equivalent.
103    You are allowed to add more types here, e.g. int_least24_t.
104 */
105
106 #define INT_LEAST8_MIN  INT8_MIN
107 #define INT_LEAST8_MAX  INT8_MAX
108 #define UINT_LEAST8_MAX UINT8_MAX
109
110 #define INT_LEAST16_MIN  INT16_MIN
111 #define INT_LEAST16_MAX  INT16_MAX
112 #define UINT_LEAST16_MAX UINT16_MAX
113
114 #define INT_LEAST32_MIN  INT32_MIN
115 #define INT_LEAST32_MAX  INT32_MAX
116 #define UINT_LEAST32_MAX UINT32_MAX
117
118 #define INT_LEAST64_MIN  INT64_MIN
119 #define INT_LEAST64_MAX  INT64_MAX
120 #define UINT_LEAST64_MAX UINT64_MAX
121
122 /* 7.18.2.3 Limits of fastest minimum-width integer types */
123
124 #define INT_FAST8_MIN  _PDCLIB_INT_FAST8_MIN
125 #define INT_FAST8_MAX  _PDCLIB_INT_FAST8_MAX
126 #define UINT_FAST8_MAX _PDCLIB_UINT_FAST8_MAX
127
128 #define INT_FAST16_MIN  _PDCLIB_INT_FAST16_MIN
129 #define INT_FAST16_MAX  _PDCLIB_INT_FAST16_MAX
130 #define UINT_FAST16_MAX _PDCLIB_UINT_FAST16_MAX
131
132 #define INT_FAST32_MIN  _PDCLIB_INT_FAST32_MIN
133 #define INT_FAST32_MAX  _PDCLIB_INT_FAST32_MAX
134 #define UINT_FAST32_MAX _PDCLIB_UINT_FAST32_MAX
135
136 #define INT_FAST64_MIN  _PDCLIB_INT_FAST64_MIN
137 #define INT_FAST64_MAX  _PDCLIB_INT_FAST64_MAX
138 #define UINT_FAST64_MAX _PDCLIB_UINT_FAST64_MAX
139
140 /* 7.18.2.4 Limits of integer types capable of holding object pointers */
141
142 #define INTPTR_MIN  _PDCLIB_INTPTR_MIN
143 #define INTPTR_MAX  _PDCLIB_INTPTR_MAX
144 #define UINTPTR_MAX _PDCLIB_UINTPTR_MAX
145
146 /* 7.18.2.5 Limits of greatest-width integer types */
147
148 #define INTMAX_MIN  _PDCLIB_INTMAX_MIN
149 #define INTMAX_MAX  _PDCLIB_INTMAX_MAX
150 #define UINTMAX_MAX _PDCLIB_UINTMAX_MAX
151
152 /* 7.18.3 Limits of other integer types */
153
154 #define PTRDIFF_MIN _PDCLIB_PTRDIFF_MIN
155 #define PTRDIFF_MAX _PDCLIB_PTRDIFF_MAX
156
157 #define SIG_ATOMIC_MIN _PDCLIB_SIG_ATOMIC_MIN
158 #define SIG_ATOMIC_MAX _PDCLIB_SIG_ATOMIC_MAX
159
160 #define SIZE_MAX _PDCLIB_SIZE_MAX
161
162 #define WCHAR_MIN _PDCLIB_WCHAR_MIN
163 #define WCHAR_MAX _PDCLIB_WCHAR_MAX
164
165 #define WINT_MIN _PDCLIB_WINT_MIN
166 #define WINT_MAX _PDCLIB_WINT_MAX
167
168 #endif
169
170 /* 7.18.4 Macros for integer constants */
171
172 #ifdef __cplusplus
173 #ifndef __STDC_CONSTANT_MACROS
174 #define _PDCLIB_NO_CONSTANT_MACROS
175 #endif
176 #endif
177
178 #ifndef _PDCLIB_NO_CONSTANT_MACROS
179
180 /* 7.18.4.1 Macros for minimum-width integer constants */
181
182 /* As the minimum-width types - for the required widths of 8, 16, 32, and 64
183    bits - are expressed in terms of the exact-width types, the mechanism for
184    these macros is to append the literal of that exact-width type to the macro
185    parameter.
186    This is considered a hack, as the author is not sure his understanding of
187    the requirements of this macro is correct. Any input appreciated.
188 */
189
190 /* Expand to an integer constant of specified value and type int_leastN_t */
191
192 #define INT8_C( value )  concat( value, _PDCLIB_INT8_LITERAL )
193 #define INT16_C( value ) concat( value, _PDCLIB_INT16_LITERAL )
194 #define INT32_C( value ) concat( value, _PDCLIB_INT32_LITERAL )
195 #define INT64_C( value ) concat( value, _PDCLIB_INT64_LITERAL )
196
197 /* Expand to an integer constant of specified value and type uint_leastN_t */
198
199 #define UINT8_C( value )  concat( value, _PDCLIB_UINT8_LITERAL )
200 #define UINT16_C( value ) concat( value, _PDCLIB_UINT16_LITERAL )
201 #define UINT32_C( value ) concat( value, _PDCLIB_UINT32_LITERAL )
202 #define UINT64_C( value ) concat( value, _PDCLIB_UINT64_LITERAL )
203
204 /* 7.18.4.2 Macros for greatest-width integer constants */
205
206 /* Expand to an integer constant of specified value and type intmax_t */
207 #define INTMAX_C( value ) _PDCLIB_INTMAX_C( value )
208
209 /* Expand to an integer constant of specified value and type uintmax_t */
210 #define UINTMAX_C( value ) _PDCLIB_UINTMAX_C( value )
211
212 #endif
213
214 #endif
215