XenevaOS
Loading...
Searching...
No Matches
stdint.h
Go to the documentation of this file.
1
30#ifndef __STDINT_H__
31#define __STDINT_H__
32
33
34#define __need_wint_t
35#define __need_wchar_t
36
37typedef unsigned char BOOL;
38
39#ifdef ARCH_ARM64
40#ifndef __cplusplus
41#ifndef bool
42typedef BOOL bool;
43#define true 1
44#define false 0
45#endif
46#endif
47#endif
48
49
50/* 7.18.1.1 Exact-width integer types */
51typedef signed char int8_t;
52typedef unsigned char uint8_t;
53typedef short int16_t;
54typedef unsigned short uint16_t;
55typedef int int32_t;
56typedef unsigned uint32_t;
57typedef long long int64_t;
58typedef unsigned long long uint64_t;
59
60typedef uint8_t uint8;
64typedef int8_t int8;
65typedef int16_t int16;
66typedef int32_t int32;
67typedef int64_t int64;
68
69
70/* 7.18.1.2 Minimum-width integer types */
71typedef signed char int_least8_t;
72typedef unsigned char uint_least8_t;
73typedef short int_least16_t;
74typedef unsigned short uint_least16_t;
75typedef int int_least32_t;
76typedef unsigned uint_least32_t;
77typedef long long int_least64_t;
78typedef unsigned long long uint_least64_t;
79
80/* 7.18.1.3 Fastest minimum-width integer types
81* Not actually guaranteed to be fastest for all purposes
82* Here we use the exact-width types for 8 and 16-bit ints.
83*/
84typedef char int_fast8_t;
85typedef unsigned char uint_fast8_t;
86typedef short int_fast16_t;
87typedef unsigned short uint_fast16_t;
88typedef int int_fast32_t;
89typedef unsigned int uint_fast32_t;
90typedef long long int_fast64_t;
91typedef unsigned long long uint_fast64_t;
92
93/* 7.18.1.4 Integer types capable of holding object pointers */
94typedef int intptr_t;
95typedef unsigned uintptr_t;
96
97/* 7.18.1.5 Greatest-width integer types */
98typedef long long intmax_t;
99typedef unsigned long long uintmax_t;
100
102
103/* 7.18.2 Limits of specified-width integer types */
104#if defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
105
106/* 7.18.2.1 Limits of exact-width integer types */
107#define INT8_MIN (-128)
108#define INT16_MIN (-32768)
109#define INT32_MIN (-2147483647 - 1)
110#define INT64_MIN (-9223372036854775807LL - 1)
111
112#define INT8_MAX 127
113#define INT16_MAX 32767
114#define INT32_MAX 2147483647
115#define INT64_MAX 9223372036854775807LL
116
117#define UINT8_MAX 0xff /* 255U */
118#define UINT16_MAX 0xffff /* 65535U */
119#define UINT32_MAX 0xffffffff /* 4294967295U */
120#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
121
122/* 7.18.2.2 Limits of minimum-width integer types */
123#define INT_LEAST8_MIN INT8_MIN
124#define INT_LEAST16_MIN INT16_MIN
125#define INT_LEAST32_MIN INT32_MIN
126#define INT_LEAST64_MIN INT64_MIN
127
128#define INT_LEAST8_MAX INT8_MAX
129#define INT_LEAST16_MAX INT16_MAX
130#define INT_LEAST32_MAX INT32_MAX
131#define INT_LEAST64_MAX INT64_MAX
132
133#define UINT_LEAST8_MAX UINT8_MAX
134#define UINT_LEAST16_MAX UINT16_MAX
135#define UINT_LEAST32_MAX UINT32_MAX
136#define UINT_LEAST64_MAX UINT64_MAX
137
138/* 7.18.2.3 Limits of fastest minimum-width integer types */
139#define INT_FAST8_MIN INT8_MIN
140#define INT_FAST16_MIN INT16_MIN
141#define INT_FAST32_MIN INT32_MIN
142#define INT_FAST64_MIN INT64_MIN
143
144#define INT_FAST8_MAX INT8_MAX
145#define INT_FAST16_MAX INT16_MAX
146#define INT_FAST32_MAX INT32_MAX
147#define INT_FAST64_MAX INT64_MAX
148
149#define UINT_FAST8_MAX UINT8_MAX
150#define UINT_FAST16_MAX UINT16_MAX
151#define UINT_FAST32_MAX UINT32_MAX
152#define UINT_FAST64_MAX UINT64_MAX
153
154/* 7.18.2.4 Limits of integer types capable of holding
155object pointers */
156#define INTPTR_MIN INT32_MIN
157#define INTPTR_MAX INT32_MAX
158#define UINTPTR_MAX UINT32_MAX
159
160/* 7.18.2.5 Limits of greatest-width integer types */
161#define INTMAX_MIN INT64_MIN
162#define INTMAX_MAX INT64_MAX
163#define UINTMAX_MAX UINT64_MAX
164
165/* 7.18.3 Limits of other integer types */
166#define PTRDIFF_MIN INT32_MIN
167#define PTRDIFF_MAX INT32_MAX
168
169#define SIG_ATOMIC_MIN INT32_MIN
170#define SIG_ATOMIC_MAX INT32_MAX
171
172#define SIZE_MAX 0xFFFFF //UINT32_MAX
173
174#ifndef WCHAR_MIN /* also in wchar.h */
175#define WCHAR_MIN 0
176#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */
177#endif
178
179/*
180* wint_t is unsigned short for compatibility with MS runtime
181*/
182#define WINT_MIN 0
183#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */
184
185#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
186
187
188/* 7.18.4 Macros for integer constants */
189#if !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS
190
191/* 7.18.4.1 Macros for minimum-width integer constants */
192
193#define INT8_C(val) ((int8_t) + (val))
194#define UINT8_C(val) ((uint8_t) + (val##U))
195#define INT16_C(val) ((int16_t) + (val))
196#define UINT16_C(val) ((uint16_t) + (val##U))
197
198#define INT32_C(val) val##L
199#define UINT32_C(val) val##UL
200#define INT64_C(val) val##LL
201#define UINT64_C(val) val##ULL
202
203/* 7.18.4.2 Macros for greatest-width integer constants */
204#define INTMAX_C(val) INT64_C(val)
205#define UINTMAX_C(val) UINT64_C(val)
206
207#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
208
209#ifdef __cplusplus
210extern "C++" {
211 template <class T, class U> intptr_t raw_diff(T* p1, U* p2)
212 {
213 return (intptr_t)p1 - (intptr_t)p2;
214 };
215 template <class T, class U> T raw_offset(U p1, const intptr_t offset)
216 {
217 return (T)((size_t)p1 + offset);
218 };
219 template <class T, class U> T mem_after(U* p1)
220 {
221 return (T)(&p1[1]);
222 };
223};
224#endif
225
226#define RAW_OFFSET(type, x, offset) (type)((size_t)x + offset)
227#define RAW_DIFF(p1,p2) ((intptr_t)p1 - (intptr_t)p2)
228#define MEM_AFTER(type, p) ((type)(&(p)[1]))
229
230#define DIV_ROUND_UP(x, y) \
231 ((x + y - 1) / y)
232
233#define ALIGN_UP(x, y) (DIV_ROUND_UP(x,y)*y)
234
235#endif
long long int_least64_t
Definition stdint.h:77
int intptr_t
Definition stdint.h:94
uint64_t size_t
Definition stdint.h:101
unsigned uintptr_t
Definition stdint.h:95
unsigned short uint16_t
Definition stdint.h:54
unsigned char uint_fast8_t
Definition stdint.h:85
unsigned uint32_t
Definition stdint.h:56
int int32_t
Definition stdint.h:55
uint8_t uint8
Definition stdint.h:60
unsigned int uint_fast32_t
Definition stdint.h:89
int int_least32_t
Definition stdint.h:75
unsigned char BOOL
Definition stdint.h:37
unsigned long long uintmax_t
Definition stdint.h:99
int64_t int64
Definition stdint.h:67
short int_least16_t
Definition stdint.h:73
long long int_fast64_t
Definition stdint.h:90
long long int64_t
Definition stdint.h:57
int int_fast32_t
Definition stdint.h:88
unsigned long long uint_least64_t
Definition stdint.h:78
int16_t int16
Definition stdint.h:65
short int16_t
Definition stdint.h:53
int8_t int8
Definition stdint.h:64
unsigned long long uint64_t
Definition stdint.h:58
unsigned uint_least32_t
Definition stdint.h:76
unsigned short uint_fast16_t
Definition stdint.h:87
unsigned char uint_least8_t
Definition stdint.h:72
unsigned long long uint_fast64_t
Definition stdint.h:91
int32_t int32
Definition stdint.h:66
unsigned char uint8_t
Definition stdint.h:52
uint64_t uint64
Definition stdint.h:63
uint16_t uint16
Definition stdint.h:61
long long intmax_t
Definition stdint.h:98
uint32_t uint32
Definition stdint.h:62
unsigned short uint_least16_t
Definition stdint.h:74
signed char int_least8_t
Definition stdint.h:71
signed char int8_t
Definition stdint.h:51
char int_fast8_t
Definition stdint.h:84
short int_fast16_t
Definition stdint.h:86
#define bool
Definition stdint.h:222
int int32_t
Definition acefiex.h:160
unsigned int uint32_t
Definition acefiex.h:163
COMPILER_DEPENDENT_INT64 int64_t
Definition acefiex.h:164
short int int16_t
Definition acefiex.h:159
unsigned char uint8_t
Definition acefiex.h:161
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
unsigned short int uint16_t
Definition acefiex.h:162
signed char int8_t
Definition acefiex.h:158