00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _GL_STDINT_H
00020 #define _GL_STDINT_H
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #if 1
00036 # if defined __sgi && ! defined __c99
00037
00038
00039
00040 # define __STDINT_H__
00041 # endif
00042
00043
00044
00045
00046 # include "
00047 #endif
00048
00049 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
00050 IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
00051 MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
00052 relies on the system <stdint.h> definitions, so include
00053 <sys/types.h> after "///usr/include/stdint.h". */
00054 #if 1
00055 # include <sys/types.h>
00056 #endif
00057
00058
00059 #include <limits.h>
00060
00061 #if 1
00062
00063
00064
00065 # define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
00066 # include <inttypes.h>
00067 # undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
00068 #elif 0
00069
00070
00071 # include <sys/inttypes.h>
00072 #endif
00073
00074 #if 1 && ! defined __BIT_TYPES_DEFINED__
00075
00076
00077
00078 # include <sys/bitypes.h>
00079 #endif
00080
00081 #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
00082
00083
00084 # if 1 && ! (defined WCHAR_MIN && defined WCHAR_MAX)
00085
00086
00087 # include <stdio.h>
00088 # include <time.h>
00089 # include <wchar.h>
00090 # endif
00091
00092 #endif
00093
00094
00095
00096
00097
00098 #define _STDINT_MIN(signed, bits, zero) \
00099 ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
00100
00101 #define _STDINT_MAX(signed, bits, zero) \
00102 ((signed) \
00103 ? ~ _STDINT_MIN (signed, bits, zero) \
00104 : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
00105
00106
00107
00108
00109
00110
00111 #undef int8_t
00112 #undef uint8_t
00113 #define int8_t signed char
00114 #define uint8_t unsigned char
00115
00116 #undef int16_t
00117 #undef uint16_t
00118 #define int16_t short int
00119 #define uint16_t unsigned short int
00120
00121 #undef int32_t
00122 #undef uint32_t
00123 #define int32_t int
00124 #define uint32_t unsigned int
00125
00126 #undef int64_t
00127 #undef uint64_t
00128 #if LONG_MAX >> 31 >> 31 == 1
00129 # define int64_t long int
00130 # define uint64_t unsigned long int
00131 #elif defined _MSC_VER
00132 # define int64_t __int64
00133 # define uint64_t unsigned __int64
00134 #elif 1
00135 # define int64_t long long int
00136 # define uint64_t unsigned long long int
00137 #endif
00138
00139
00140 #define _UINT8_T
00141 #define _UINT32_T
00142 #define _UINT64_T
00143
00144
00145
00146
00147
00148
00149
00150
00151 #undef int_least8_t
00152 #undef uint_least8_t
00153 #undef int_least16_t
00154 #undef uint_least16_t
00155 #undef int_least32_t
00156 #undef uint_least32_t
00157 #undef int_least64_t
00158 #undef uint_least64_t
00159 #define int_least8_t int8_t
00160 #define uint_least8_t uint8_t
00161 #define int_least16_t int16_t
00162 #define uint_least16_t uint16_t
00163 #define int_least32_t int32_t
00164 #define uint_least32_t uint32_t
00165 #ifdef int64_t
00166 # define int_least64_t int64_t
00167 # define uint_least64_t uint64_t
00168 #endif
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 #undef int_fast8_t
00181 #undef uint_fast8_t
00182 #undef int_fast16_t
00183 #undef uint_fast16_t
00184 #undef int_fast32_t
00185 #undef uint_fast32_t
00186 #undef int_fast64_t
00187 #undef uint_fast64_t
00188 #define int_fast8_t long int
00189 #define uint_fast8_t unsigned int_fast8_t
00190 #define int_fast16_t long int
00191 #define uint_fast16_t unsigned int_fast16_t
00192 #define int_fast32_t long int
00193 #define uint_fast32_t unsigned int_fast32_t
00194 #ifdef int64_t
00195 # define int_fast64_t int64_t
00196 # define uint_fast64_t uint64_t
00197 #endif
00198
00199
00200
00201 #undef intptr_t
00202 #undef uintptr_t
00203 #define intptr_t long int
00204 #define uintptr_t unsigned long int
00205
00206
00207
00208
00209
00210
00211 #undef intmax_t
00212 #undef uintmax_t
00213 #if 1 && LONG_MAX >> 30 == 1
00214 # define intmax_t long long int
00215 # define uintmax_t unsigned long long int
00216 #elif defined int64_t
00217 # define intmax_t int64_t
00218 # define uintmax_t uint64_t
00219 #else
00220 # define intmax_t long int
00221 # define uintmax_t unsigned long int
00222 #endif
00223
00224
00225
00226 #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
00227
00228
00229
00230
00231
00232
00233 #undef INT8_MIN
00234 #undef INT8_MAX
00235 #undef UINT8_MAX
00236 #define INT8_MIN (~ INT8_MAX)
00237 #define INT8_MAX 127
00238 #define UINT8_MAX 255
00239
00240 #undef INT16_MIN
00241 #undef INT16_MAX
00242 #undef UINT16_MAX
00243 #define INT16_MIN (~ INT16_MAX)
00244 #define INT16_MAX 32767
00245 #define UINT16_MAX 65535
00246
00247 #undef INT32_MIN
00248 #undef INT32_MAX
00249 #undef UINT32_MAX
00250 #define INT32_MIN (~ INT32_MAX)
00251 #define INT32_MAX 2147483647
00252 #define UINT32_MAX 4294967295U
00253
00254 #undef INT64_MIN
00255 #undef INT64_MAX
00256 #undef UINT64_MAX
00257 #ifdef int64_t
00258 # define INT64_MIN (~ INT64_MAX)
00259 # define INT64_MAX INTMAX_C (9223372036854775807)
00260 # define UINT64_MAX UINTMAX_C (18446744073709551615)
00261 #endif
00262
00263
00264
00265
00266
00267
00268
00269 #undef INT_LEAST8_MIN
00270 #undef INT_LEAST8_MAX
00271 #undef UINT_LEAST8_MAX
00272 #define INT_LEAST8_MIN INT8_MIN
00273 #define INT_LEAST8_MAX INT8_MAX
00274 #define UINT_LEAST8_MAX UINT8_MAX
00275
00276 #undef INT_LEAST16_MIN
00277 #undef INT_LEAST16_MAX
00278 #undef UINT_LEAST16_MAX
00279 #define INT_LEAST16_MIN INT16_MIN
00280 #define INT_LEAST16_MAX INT16_MAX
00281 #define UINT_LEAST16_MAX UINT16_MAX
00282
00283 #undef INT_LEAST32_MIN
00284 #undef INT_LEAST32_MAX
00285 #undef UINT_LEAST32_MAX
00286 #define INT_LEAST32_MIN INT32_MIN
00287 #define INT_LEAST32_MAX INT32_MAX
00288 #define UINT_LEAST32_MAX UINT32_MAX
00289
00290 #undef INT_LEAST64_MIN
00291 #undef INT_LEAST64_MAX
00292 #undef UINT_LEAST64_MAX
00293 #ifdef int64_t
00294 # define INT_LEAST64_MIN INT64_MIN
00295 # define INT_LEAST64_MAX INT64_MAX
00296 # define UINT_LEAST64_MAX UINT64_MAX
00297 #endif
00298
00299
00300
00301
00302
00303
00304
00305 #undef INT_FAST8_MIN
00306 #undef INT_FAST8_MAX
00307 #undef UINT_FAST8_MAX
00308 #define INT_FAST8_MIN LONG_MIN
00309 #define INT_FAST8_MAX LONG_MAX
00310 #define UINT_FAST8_MAX ULONG_MAX
00311
00312 #undef INT_FAST16_MIN
00313 #undef INT_FAST16_MAX
00314 #undef UINT_FAST16_MAX
00315 #define INT_FAST16_MIN LONG_MIN
00316 #define INT_FAST16_MAX LONG_MAX
00317 #define UINT_FAST16_MAX ULONG_MAX
00318
00319 #undef INT_FAST32_MIN
00320 #undef INT_FAST32_MAX
00321 #undef UINT_FAST32_MAX
00322 #define INT_FAST32_MIN LONG_MIN
00323 #define INT_FAST32_MAX LONG_MAX
00324 #define UINT_FAST32_MAX ULONG_MAX
00325
00326 #undef INT_FAST64_MIN
00327 #undef INT_FAST64_MAX
00328 #undef UINT_FAST64_MAX
00329 #ifdef int64_t
00330 # define INT_FAST64_MIN INT64_MIN
00331 # define INT_FAST64_MAX INT64_MAX
00332 # define UINT_FAST64_MAX UINT64_MAX
00333 #endif
00334
00335
00336
00337 #undef INTPTR_MIN
00338 #undef INTPTR_MAX
00339 #undef UINTPTR_MAX
00340 #define INTPTR_MIN LONG_MIN
00341 #define INTPTR_MAX LONG_MAX
00342 #define UINTPTR_MAX ULONG_MAX
00343
00344
00345
00346 #undef INTMAX_MIN
00347 #undef INTMAX_MAX
00348 #undef UINTMAX_MAX
00349 #define INTMAX_MIN (~ INTMAX_MAX)
00350 #ifdef INT64_MAX
00351 # define INTMAX_MAX INT64_MAX
00352 # define UINTMAX_MAX UINT64_MAX
00353 #else
00354 # define INTMAX_MAX INT32_MAX
00355 # define UINTMAX_MAX UINT32_MAX
00356 #endif
00357
00358
00359
00360
00361 #undef PTRDIFF_MIN
00362 #undef PTRDIFF_MAX
00363 #define PTRDIFF_MIN \
00364 _STDINT_MIN (1, 32, 0)
00365 #define PTRDIFF_MAX \
00366 _STDINT_MAX (1, 32, 0)
00367
00368
00369 #undef SIG_ATOMIC_MIN
00370 #undef SIG_ATOMIC_MAX
00371 #define SIG_ATOMIC_MIN \
00372 _STDINT_MIN (1, 32, \
00373 0)
00374 #define SIG_ATOMIC_MAX \
00375 _STDINT_MAX (1, 32, \
00376 0)
00377
00378
00379
00380 #undef SIZE_MAX
00381 #define SIZE_MAX _STDINT_MAX (0, 32, 0u)
00382
00383
00384 #undef WCHAR_MIN
00385 #undef WCHAR_MAX
00386 #define WCHAR_MIN \
00387 _STDINT_MIN (1, 32, 0)
00388 #define WCHAR_MAX \
00389 _STDINT_MAX (1, 32, 0)
00390
00391
00392 #undef WINT_MIN
00393 #undef WINT_MAX
00394 #define WINT_MIN \
00395 _STDINT_MIN (0, 32, 0u)
00396 #define WINT_MAX \
00397 _STDINT_MAX (0, 32, 0u)
00398
00399 #endif
00400
00401
00402
00403 #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
00404
00405
00406
00407
00408
00409
00410
00411 #undef INT8_C
00412 #undef UINT8_C
00413 #define INT8_C(x) x
00414 #define UINT8_C(x) x
00415
00416 #undef INT16_C
00417 #undef UINT16_C
00418 #define INT16_C(x) x
00419 #define UINT16_C(x) x
00420
00421 #undef INT32_C
00422 #undef UINT32_C
00423 #define INT32_C(x) x
00424 #define UINT32_C(x) x ## U
00425
00426 #undef INT64_C
00427 #undef UINT64_C
00428 #if LONG_MAX >> 31 >> 31 == 1
00429 # define INT64_C(x) x##L
00430 # define UINT64_C(x) x##UL
00431 #elif defined _MSC_VER
00432 # define INT64_C(x) x##i64
00433 # define UINT64_C(x) x##ui64
00434 #elif 1
00435 # define INT64_C(x) x##LL
00436 # define UINT64_C(x) x##ULL
00437 #endif
00438
00439
00440
00441 #undef INTMAX_C
00442 #undef UINTMAX_C
00443 #if 1 && LONG_MAX >> 30 == 1
00444 # define INTMAX_C(x) x##LL
00445 # define UINTMAX_C(x) x##ULL
00446 #elif defined int64_t
00447 # define INTMAX_C(x) INT64_C(x)
00448 # define UINTMAX_C(x) UINT64_C(x)
00449 #else
00450 # define INTMAX_C(x) x##L
00451 # define UINTMAX_C(x) x##UL
00452 #endif
00453
00454 #endif
00455
00456 #endif