blob: a2968197dbe2312c46de0d41f09675b56846984c [file] [log] [blame]
Rich Felker0b44a032011-02-12 00:22:29 -05001#ifndef _STDINT_H
2#define _STDINT_H
3
4#define __NEED_int8_t
5#define __NEED_int16_t
6#define __NEED_int32_t
7#define __NEED_int64_t
8
9#define __NEED_uint8_t
10#define __NEED_uint16_t
11#define __NEED_uint32_t
12#define __NEED_uint64_t
13
Rich Felker0b44a032011-02-12 00:22:29 -050014#define __NEED_intptr_t
15#define __NEED_uintptr_t
Rich Felker0b44a032011-02-12 00:22:29 -050016
Rich Felkerf77bab52013-04-04 20:09:50 -040017#define __NEED_intmax_t
18#define __NEED_uintmax_t
19
Rich Felker0b44a032011-02-12 00:22:29 -050020#include <bits/alltypes.h>
21
Rich Felker9448b052013-07-22 11:22:36 -040022typedef int8_t int_fast8_t;
23typedef int64_t int_fast64_t;
24
Rich Felker28bde3b2011-04-11 10:38:00 -040025typedef int8_t int_least8_t;
26typedef int16_t int_least16_t;
27typedef int32_t int_least32_t;
28typedef int64_t int_least64_t;
29
Rich Felker9448b052013-07-22 11:22:36 -040030typedef uint8_t uint_fast8_t;
31typedef uint64_t uint_fast64_t;
32
Rich Felker28bde3b2011-04-11 10:38:00 -040033typedef uint8_t uint_least8_t;
34typedef uint16_t uint_least16_t;
35typedef uint32_t uint_least32_t;
36typedef uint64_t uint_least64_t;
37
Rich Felker0b44a032011-02-12 00:22:29 -050038#define INT8_MIN (-1-0x7f)
39#define INT16_MIN (-1-0x7fff)
40#define INT32_MIN (-1-0x7fffffff)
Rich Felkerf77bab52013-04-04 20:09:50 -040041#define INT64_MIN (-1-0x7fffffffffffffff)
Rich Felker0b44a032011-02-12 00:22:29 -050042
43#define INT8_MAX (0x7f)
44#define INT16_MAX (0x7fff)
45#define INT32_MAX (0x7fffffff)
Rich Felkerf77bab52013-04-04 20:09:50 -040046#define INT64_MAX (0x7fffffffffffffff)
Rich Felker0b44a032011-02-12 00:22:29 -050047
48#define UINT8_MAX (0xff)
49#define UINT16_MAX (0xffff)
Rich Felkerdac4fc42014-12-21 02:30:29 -050050#define UINT32_MAX (0xffffffffu)
51#define UINT64_MAX (0xffffffffffffffffu)
Rich Felker0b44a032011-02-12 00:22:29 -050052
Rich Felker9448b052013-07-22 11:22:36 -040053#define INT_FAST8_MIN INT8_MIN
54#define INT_FAST64_MIN INT64_MIN
55
Rich Felker0b44a032011-02-12 00:22:29 -050056#define INT_LEAST8_MIN INT8_MIN
57#define INT_LEAST16_MIN INT16_MIN
58#define INT_LEAST32_MIN INT32_MIN
59#define INT_LEAST64_MIN INT64_MIN
60
Rich Felker9448b052013-07-22 11:22:36 -040061#define INT_FAST8_MAX INT8_MAX
62#define INT_FAST64_MAX INT64_MAX
63
Rich Felker0b44a032011-02-12 00:22:29 -050064#define INT_LEAST8_MAX INT8_MAX
65#define INT_LEAST16_MAX INT16_MAX
66#define INT_LEAST32_MAX INT32_MAX
67#define INT_LEAST64_MAX INT64_MAX
68
Rich Felker9448b052013-07-22 11:22:36 -040069#define UINT_FAST8_MAX UINT8_MAX
70#define UINT_FAST64_MAX UINT64_MAX
71
Rich Felker0b44a032011-02-12 00:22:29 -050072#define UINT_LEAST8_MAX UINT8_MAX
73#define UINT_LEAST16_MAX UINT16_MAX
74#define UINT_LEAST32_MAX UINT32_MAX
75#define UINT_LEAST64_MAX UINT64_MAX
76
Rich Felker0b44a032011-02-12 00:22:29 -050077#define INTMAX_MIN INT64_MIN
78#define INTMAX_MAX INT64_MAX
79#define UINTMAX_MAX UINT64_MAX
80
Rich Felkeraee9b152014-12-17 16:52:37 -050081#define WINT_MIN 0U
Rich Felkerc4dd0c92013-07-22 13:05:41 -040082#define WINT_MAX UINT32_MAX
Rich Felker224c7a32011-09-19 17:39:51 -040083
Rich Felkerc7af2712013-04-04 19:57:23 -040084#if L'\0'-1 > 0
85#define WCHAR_MAX (0xffffffffu+L'\0')
86#define WCHAR_MIN (0+L'\0')
87#else
88#define WCHAR_MAX (0x7fffffff+L'\0')
89#define WCHAR_MIN (-1-0x7fffffff+L'\0')
90#endif
91
Rich Felker9448b052013-07-22 11:22:36 -040092#define SIG_ATOMIC_MIN INT32_MIN
93#define SIG_ATOMIC_MAX INT32_MAX
94
Rich Felker0b44a032011-02-12 00:22:29 -050095#include <bits/stdint.h>
96
Rich Felkera591e032012-02-07 12:08:27 -050097#define INT8_C(c) c
98#define INT16_C(c) c
Rich Felker0b44a032011-02-12 00:22:29 -050099#define INT32_C(c) c
Rich Felker0b44a032011-02-12 00:22:29 -0500100
Rich Felker3d649462012-06-08 11:11:44 -0400101#define UINT8_C(c) c
102#define UINT16_C(c) c
Rich Felker0b44a032011-02-12 00:22:29 -0500103#define UINT32_C(c) c ## U
Rich Felker0b44a032011-02-12 00:22:29 -0500104
Rich Felkerf77bab52013-04-04 20:09:50 -0400105#if UINTPTR_MAX == UINT64_MAX
106#define INT64_C(c) c ## L
107#define UINT64_C(c) c ## UL
108#define INTMAX_C(c) c ## L
109#define UINTMAX_C(c) c ## UL
110#else
111#define INT64_C(c) c ## LL
112#define UINT64_C(c) c ## ULL
Rich Felker0b44a032011-02-12 00:22:29 -0500113#define INTMAX_C(c) c ## LL
114#define UINTMAX_C(c) c ## ULL
Rich Felkerf77bab52013-04-04 20:09:50 -0400115#endif
Rich Felker0b44a032011-02-12 00:22:29 -0500116
117#endif