2 * Copyright 2003-2017 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
9 #include <config/types.h>
12 /* Exact-width integer types */
13 typedef __haiku_std_int8
int8_t;
14 typedef __haiku_std_uint8
uint8_t;
16 typedef __haiku_std_int16
int16_t;
17 typedef __haiku_std_uint16
uint16_t;
19 typedef __haiku_std_int32
int32_t;
20 typedef __haiku_std_uint32
uint32_t;
22 typedef __haiku_std_int64
int64_t;
23 typedef __haiku_std_uint64
uint64_t;
25 /* Minimum-width integer types */
26 typedef int8_t int_least8_t;
27 typedef uint8_t uint_least8_t;
29 typedef int16_t int_least16_t;
30 typedef uint16_t uint_least16_t;
32 typedef int32_t int_least32_t;
33 typedef uint32_t uint_least32_t;
35 typedef int64_t int_least64_t;
36 typedef uint64_t uint_least64_t;
38 /* Fastest minimum-width integer types */
39 typedef int32_t int_fast8_t;
40 typedef uint32_t uint_fast8_t;
42 typedef int32_t int_fast16_t;
43 typedef uint32_t uint_fast16_t;
45 typedef int32_t int_fast32_t;
46 typedef uint32_t uint_fast32_t;
48 typedef int64_t int_fast64_t;
49 typedef uint64_t uint_fast64_t;
51 /* Integer types capable of holding object pointers */
52 typedef __haiku_saddr_t
intptr_t;
53 typedef __haiku_addr_t
uintptr_t;
55 /* Greatest-width integer types */
56 typedef int64_t intmax_t;
57 typedef uint64_t uintmax_t;
59 /* Limits of exact-width integer types */
60 #define INT8_MIN (-128)
61 #define INT8_MAX (127)
62 #define UINT8_MAX (255U)
64 #define INT16_MIN (-32768)
65 #define INT16_MAX (32767)
66 #define UINT16_MAX (65535U)
68 #define INT32_MAX (2147483647)
69 #define INT32_MIN (-INT32_MAX-1)
70 #define UINT32_MAX (4294967295U)
72 #if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ > 4
73 #define INT64_MAX (9223372036854775807L)
74 #define UINT64_MAX (18446744073709551615UL)
76 #define INT64_MAX (9223372036854775807LL)
77 #define UINT64_MAX (18446744073709551615ULL)
79 #define INT64_MIN (-INT64_MAX-1)
81 /* Limits of minimum-width integer types */
82 #define INT_LEAST8_MIN INT8_MIN
83 #define INT_LEAST8_MAX INT8_MAX
84 #define UINT_LEAST8_MAX UINT8_MAX
86 #define INT_LEAST16_MIN INT16_MIN
87 #define INT_LEAST16_MAX INT16_MAX
88 #define UINT_LEAST16_MAX UINT16_MAX
90 #define INT_LEAST32_MIN INT32_MIN
91 #define INT_LEAST32_MAX INT32_MAX
92 #define UINT_LEAST32_MAX UINT32_MAX
94 #define INT_LEAST64_MIN INT64_MIN
95 #define INT_LEAST64_MAX INT64_MAX
96 #define UINT_LEAST64_MAX UINT64_MAX
98 /* Limits of fastest minimum-width integer types */
99 #define INT_FAST8_MIN INT8_MIN
100 #define INT_FAST8_MAX INT8_MAX
101 #define UINT_FAST8_MAX UINT8_MAX
103 #define INT_FAST16_MIN INT16_MIN
104 #define INT_FAST16_MAX INT16_MAX
105 #define UINT_FAST16_MAX UINT16_MAX
107 #define INT_FAST32_MIN INT32_MIN
108 #define INT_FAST32_MAX INT32_MAX
109 #define UINT_FAST32_MAX UINT32_MAX
111 #define INT_FAST64_MIN INT64_MIN
112 #define INT_FAST64_MAX INT64_MAX
113 #define UINT_FAST64_MAX UINT64_MAX
115 /* Limits of Integer types capable of holding object pointers */
116 #define INTPTR_MIN __HAIKU_SADDR_MIN
117 #define INTPTR_MAX __HAIKU_SADDR_MAX
118 #define UINTPTR_MAX __HAIKU_ADDR_MAX
120 /* Limits of Greatest-width integer types */
121 #define INTMAX_MIN INT64_MIN
122 #define INTMAX_MAX INT64_MAX
123 #define UINTMAX_MAX UINT64_MAX
125 /* Limits of other integer types */
126 #define PTRDIFF_MIN __HAIKU_SADDR_MIN
127 #define PTRDIFF_MAX __HAIKU_SADDR_MAX
129 #define SIG_ATOMIC_MIN INT32_MIN
130 #define SIG_ATOMIC_MAX INT32_MAX
132 #define SIZE_MAX __HAIKU_ADDR_MAX
135 #define WINT_MAX ((wint_t)-1)
138 /* Macros of Integer Constant Expressions */
139 #define INT8_C(value) value
140 #define INT16_C(value) value
141 #define INT32_C(value) value
143 #define UINT8_C(value) value ## U
144 #define UINT16_C(value) value ## U
145 #define UINT32_C(value) value ## U
147 #if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ > 4
148 #define INT64_C(value) value ## L
149 #define UINT64_C(value) value ## UL
150 #define INTMAX_C(value) value ## L
151 #define UINTMAX_C(value) value ## UL
153 #define INT64_C(value) value ## LL
154 #define UINT64_C(value) value ## ULL
155 #define INTMAX_C(value) value ## LL
156 #define UINTMAX_C(value) value ## ULL
160 /* BSD compatibility */
161 typedef uint8_t u_int8_t
;
162 typedef uint16_t u_int16_t
;
163 typedef uint32_t u_int32_t
;
164 typedef uint64_t u_int64_t
;
167 #endif /* _STDINT_H_ */