blob: c817e1b61f1a28cdd7c7b50fbbce313e03b09e5b [file] [log] [blame]
Stefan Reinauer7ffc71e2015-03-15 19:49:11 +01001#ifndef X86_STDINT_H
2#define X86_STDINT_H
Eric Biederman8ca8d762003-04-22 19:02:15 +00003
Stefan Reinauer52fc6b12009-10-24 13:06:04 +00004#if defined(__GNUC__)
Eric Biederman52685572003-05-19 19:16:21 +00005#define __HAVE_LONG_LONG__ 1
6#else
7#define __HAVE_LONG_LONG__ 0
8#endif
9
Eric Biederman8ca8d762003-04-22 19:02:15 +000010/* Exact integral types */
11typedef unsigned char uint8_t;
Stefan Reinauer14e22772010-04-27 06:56:47 +000012typedef signed char int8_t;
Eric Biederman8ca8d762003-04-22 19:02:15 +000013
14typedef unsigned short uint16_t;
15typedef signed short int16_t;
16
17typedef unsigned int uint32_t;
18typedef signed int int32_t;
19
Eric Biederman52685572003-05-19 19:16:21 +000020#if __HAVE_LONG_LONG__
Eric Biederman8ca8d762003-04-22 19:02:15 +000021typedef unsigned long long uint64_t;
22typedef signed long long int64_t;
Eric Biederman52685572003-05-19 19:16:21 +000023#endif
Eric Biederman8ca8d762003-04-22 19:02:15 +000024
25/* Small types */
26typedef unsigned char uint_least8_t;
Stefan Reinauer14e22772010-04-27 06:56:47 +000027typedef signed char int_least8_t;
Eric Biederman8ca8d762003-04-22 19:02:15 +000028
29typedef unsigned short uint_least16_t;
30typedef signed short int_least16_t;
31
32typedef unsigned int uint_least32_t;
33typedef signed int int_least32_t;
34
Eric Biederman52685572003-05-19 19:16:21 +000035#if __HAVE_LONG_LONG__
Eric Biederman8ca8d762003-04-22 19:02:15 +000036typedef unsigned long long uint_least64_t;
37typedef signed long long int_least64_t;
Eric Biederman52685572003-05-19 19:16:21 +000038#endif
Eric Biederman8ca8d762003-04-22 19:02:15 +000039
40/* Fast Types */
41typedef unsigned char uint_fast8_t;
Stefan Reinauer14e22772010-04-27 06:56:47 +000042typedef signed char int_fast8_t;
Eric Biederman8ca8d762003-04-22 19:02:15 +000043
44typedef unsigned int uint_fast16_t;
45typedef signed int int_fast16_t;
46
47typedef unsigned int uint_fast32_t;
48typedef signed int int_fast32_t;
49
Eric Biederman52685572003-05-19 19:16:21 +000050#if __HAVE_LONG_LONG__
Eric Biederman8ca8d762003-04-22 19:02:15 +000051typedef unsigned long long uint_fast64_t;
52typedef signed long long int_fast64_t;
Stefan Reinauer14e22772010-04-27 06:56:47 +000053#endif
Eric Biederman8ca8d762003-04-22 19:02:15 +000054
55/* Types for `void *' pointers. */
Stefan Reinauer7ffc71e2015-03-15 19:49:11 +010056typedef long intptr_t;
57typedef unsigned long uintptr_t;
Eric Biederman8ca8d762003-04-22 19:02:15 +000058
59/* Largest integral types */
Eric Biederman52685572003-05-19 19:16:21 +000060#if __HAVE_LONG_LONG__
Eric Biederman8ca8d762003-04-22 19:02:15 +000061typedef long long int intmax_t;
62typedef unsigned long long uintmax_t;
Eric Biederman52685572003-05-19 19:16:21 +000063#else
64typedef long int intmax_t;
65typedef unsigned long int uintmax_t;
66#endif
67
Yinghai Lu21332b82007-04-06 19:49:05 +000068typedef uint8_t u8;
69typedef uint16_t u16;
70typedef uint32_t u32;
Stefan Reinauer36c83402009-03-01 10:16:01 +000071#if __HAVE_LONG_LONG__
72typedef uint64_t u64;
73#endif
Stefan Reinauerea9a1f62012-12-18 14:25:56 -080074typedef int8_t s8;
75typedef int16_t s16;
76typedef int32_t s32;
77
Alexandru Gagniuca5839242015-01-25 20:46:55 -060078typedef uint8_t bool;
79#define true 1
80#define false 0
Yinghai Lu21332b82007-04-06 19:49:05 +000081
Aaron Durbind466d752013-03-19 12:41:29 -050082#ifndef UINT32_MAX
83#define UINT32_MAX (4294967295U)
84#endif
85#ifndef UINT64_MAX
86# define UINT64_MAX (18446744073709551615ULL)
87#endif
Stefan Reinauer7ffc71e2015-03-15 19:49:11 +010088
89#ifdef __x86_64__
90
91#ifndef UINT64_C
92#define UINT64_C(c) c ## UL
93#endif
94#ifndef PRIu64
95#define PRIu64 "lu"
96#endif
97
98#else
99
Aaron Durbind466d752013-03-19 12:41:29 -0500100#ifndef UINT64_C
101#define UINT64_C(c) c ## ULL
102#endif
103#ifndef PRIu64
104#define PRIu64 "llu"
105#endif
106
Stefan Reinauer7ffc71e2015-03-15 19:49:11 +0100107#endif
108
Aaron Durbind466d752013-03-19 12:41:29 -0500109
Stefan Reinauer36c83402009-03-01 10:16:01 +0000110#undef __HAVE_LONG_LONG__
Eric Biederman8ca8d762003-04-22 19:02:15 +0000111
Stefan Reinauer7ffc71e2015-03-15 19:49:11 +0100112#endif /* X86_STDINT_H */