cleanup types stuff in headers, fix missing u_int*_t in sys/types.h
[musl] / include / stdint.h
1 #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
14 #define __NEED_int_least8_t
15 #define __NEED_int_least16_t
16 #define __NEED_int_least32_t
17 #define __NEED_int_least64_t
18
19 #define __NEED_uint_least8_t
20 #define __NEED_uint_least16_t
21 #define __NEED_uint_least32_t
22 #define __NEED_uint_least64_t
23
24 #define __NEED_int_fast8_t
25 #define __NEED_int_fast16_t
26 #define __NEED_int_fast32_t
27 #define __NEED_int_fast64_t
28
29 #define __NEED_uint_fast8_t
30 #define __NEED_uint_fast16_t
31 #define __NEED_uint_fast32_t
32 #define __NEED_uint_fast64_t
33
34 #define __NEED_intptr_t
35 #define __NEED_uintptr_t
36 #define __NEED_intmax_t
37 #define __NEED_uintmax_t
38
39 #include <bits/alltypes.h>
40
41 typedef int8_t  int_least8_t;
42 typedef int16_t int_least16_t;
43 typedef int32_t int_least32_t;
44 typedef int64_t int_least64_t;
45
46 typedef uint8_t  uint_least8_t;
47 typedef uint16_t uint_least16_t;
48 typedef uint32_t uint_least32_t;
49 typedef uint64_t uint_least64_t;
50
51 #if !defined __cplusplus || defined __STDC_LIMIT_MACROS
52
53 #define INT8_MIN   (-1-0x7f)
54 #define INT16_MIN  (-1-0x7fff)
55 #define INT32_MIN  (-1-0x7fffffff)
56 #define INT64_MIN  (-1-0x7fffffffffffffffLL)
57
58 #define INT8_MAX   (0x7f)
59 #define INT16_MAX  (0x7fff)
60 #define INT32_MAX  (0x7fffffff)
61 #define INT64_MAX  (0x7fffffffffffffffLL)
62
63 #define UINT8_MAX  (0xff)
64 #define UINT16_MAX (0xffff)
65 #define UINT32_MAX (0xffffffff)
66 #define UINT64_MAX (0xffffffffffffffffULL)
67
68 #define INT_LEAST8_MIN   INT8_MIN
69 #define INT_LEAST16_MIN  INT16_MIN
70 #define INT_LEAST32_MIN  INT32_MIN
71 #define INT_LEAST64_MIN  INT64_MIN
72
73 #define INT_LEAST8_MAX   INT8_MAX
74 #define INT_LEAST16_MAX  INT16_MAX
75 #define INT_LEAST32_MAX  INT32_MAX
76 #define INT_LEAST64_MAX  INT64_MAX
77
78 #define UINT_LEAST8_MAX  UINT8_MAX
79 #define UINT_LEAST16_MAX UINT16_MAX
80 #define UINT_LEAST32_MAX UINT32_MAX
81 #define UINT_LEAST64_MAX UINT64_MAX
82
83 #undef WCHAR_MIN
84 #undef WCHAR_MAX
85 #undef WINT_MIN
86 #undef WINT_MAX
87 #define WCHAR_MIN INT32_MIN
88 #define WCHAR_MAX INT32_MAX
89 #define WINT_MIN INT32_MIN
90 #define WINT_MAX INT32_MAX
91
92 #define INTMAX_MIN  INT64_MIN
93 #define INTMAX_MAX  INT64_MAX
94 #define UINTMAX_MAX UINT64_MAX
95
96 #include <bits/stdint.h>
97
98 #endif
99
100 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
101
102 #define INT8_C(c)  c
103 #define INT16_C(c) c
104 #define INT32_C(c) c
105 #define INT64_C(c) c ## LL
106
107 #define UINT8_C(c)  c ## U
108 #define UINT16_C(c) c ## U
109 #define UINT32_C(c) c ## U
110 #define UINT64_C(c) c ## ULL
111
112 #define INTMAX_C(c)  c ## LL
113 #define UINTMAX_C(c) c ## ULL
114
115 #endif
116
117 #endif