1 #ifndef _PDCLIB_STDINT_H
2 #define _PDCLIB_STDINT_H _PDCLIB_STDINT_H
6 /* 7.18 Integer types <stdint.h>
8 This file is part of the Public Domain C Library (PDCLib).
9 Permission is granted to use, modify, and / or redistribute at will.
12 #ifndef _PDCLIB_DEFS_H
13 #define _PDCLIB_DEFS_H _PDCLIB_DEFS_H
14 #include <_PDCLIB_defs.h>
17 /* 7.18.1.1 Exact-width integer types. */
19 typedef _PDCLIB_int8_t int8_t;
20 typedef _PDCLIB_int16_t int16_t;
21 typedef _PDCLIB_int32_t int32_t;
22 typedef _PDCLIB_int64_t int64_t;
24 typedef _PDCLIB_uint8_t uint8_t;
25 typedef _PDCLIB_uint16_t uint16_t;
26 typedef _PDCLIB_uint32_t uint32_t;
27 typedef _PDCLIB_uint64_t uint64_t;
29 /* 7.18.1.2 Minimum-width integer types */
31 typedef int8_t int_least8_t;
32 typedef int16_t int_least16_t;
33 typedef int32_t int_least32_t;
34 typedef int64_t int_least64_t;
36 typedef uint8_t uint_least8_t;
37 typedef uint16_t uint_least16_t;
38 typedef uint32_t uint_least32_t;
39 typedef uint64_t uint_least64_t;
41 /* 7.18.1.3 Fastest minimum-width integer types */
43 /* You are allowed to add more types here, e.g. int_fast24_t. */
45 typedef _PDCLIB_int_fast8_t int_fast8_t;
46 typedef _PDCLIB_int_fast16_t int_fast16_t;
47 typedef _PDCLIB_int_fast32_t int_fast32_t;
48 typedef _PDCLIB_int_fast64_t int_fast64_t;
50 typedef _PDCLIB_uint_fast8_t uint_fast8_t;
51 typedef _PDCLIB_uint_fast16_t uint_fast16_t;
52 typedef _PDCLIB_uint_fast32_t uint_fast32_t;
53 typedef _PDCLIB_uint_fast64_t uint_fast64_t;
55 /* 7.18.1.4 Integer types capable of holding object pointers */
57 typedef _PDCLIB_intptr_t intptr_t;
58 typedef _PDCLIB_uintptr_t uintptr_t;
60 /* 7.18.1.5 Greatest-width integer types */
62 typedef _PDCLIB_intmax_t intmax_t;
63 typedef _PDCLIB_uintmax_t uintmax_t;
65 /* 7.18.2 Limits of specified-width integer types */
68 #ifndef __STDC_LIMIT_MACROS
69 #define _PDCLIB_NO_LIMIT_MACROS
73 #ifndef _PDCLIB_NO_LIMIT_MACROS
75 /* 7.18.2.1 Limits of exact-width integer types */
77 #define INT8_MIN (-0x7f - 1)
79 #define UINT8_MAX 0xff
81 #define INT16_MIN (-0x7fff - 1)
82 #define INT16_MAX 0x7fff
83 #define UINT16_MAX 0xffff
85 #define INT32_MIN (-0x7fffffff - 1)
86 #define INT32_MAX 0x7fffffff
87 #define UINT32_MAX 0xffffffff
89 #define INT64_MIN (-0x7fffffffffffffff - 1)
90 #define INT64_MAX 0x7fffffffffffffff
91 #define UINT64_MAX 0xffffffffffffffff
93 /* 7.18.2.2 Limits of minimum-width integer types */
95 /* See the comment at 7.18.1.2 as to type equivalence. */
97 #define INT_LEAST8_MIN INT8_MIN
98 #define INT_LEAST8_MAX INT8_MAX
99 #define UINT_LEAST8_MAX UINT8_MAX
101 #define INT_LEAST16_MIN INT16_MIN
102 #define INT_LEAST16_MAX INT16_MAX
103 #define UINT_LEAST16_MAX UINT16_MAX
105 #define INT_LEAST32_MIN INT32_MIN
106 #define INT_LEAST32_MAX INT32_MAX
107 #define UINT_LEAST32_MAX UINT32_MAX
109 #define INT_LEAST64_MIN INT64_MIN
110 #define INT_LEAST64_MAX INT64_MAX
111 #define UINT_LEAST64_MAX UINT64_MAX
113 /* 7.18.2.3 Limits of fastest minimum-width integer types */
115 #define INT_FAST8_MIN _PDCLIB_INT_FAST8_MIN
116 #define INT_FAST8_MAX _PDCLIB_INT_FAST8_MAX
117 #define UINT_FAST8_MAX _PDCLIB_UINT_FAST8_MAX
119 #define INT_FAST16_MIN _PDCLIB_INT_FAST16_MIN
120 #define INT_FAST16_MAX _PDCLIB_INT_FAST16_MAX
121 #define UINT_FAST16_MAX _PDCLIB_UINT_FAST16_MAX
123 #define INT_FAST32_MIN _PDCLIB_INT_FAST32_MIN
124 #define INT_FAST32_MAX _PDCLIB_INT_FAST32_MAX
125 #define UINT_FAST32_MAX _PDCLIB_UINT_FAST32_MAX
127 #define INT_FAST64_MIN _PDCLIB_INT_FAST64_MIN
128 #define INT_FAST64_MAX _PDCLIB_INT_FAST64_MAX
129 #define UINT_FAST64_MAX _PDCLIB_UINT_FAST64_MAX
131 /* 7.18.2.4 Limits of integer types capable of holding object pointers */
133 #define INTPTR_MIN _PDCLIB_INTPTR_MIN
134 #define INTPTR_MAX _PDCLIB_INTPTR_MAX
135 #define UINTPTR_MAX _PDCLIB_UINTPTR_MAX
137 /* 7.18.2.5 Limits of greatest-width integer types */
139 #define INTMAX_MIN _PDCLIB_INTMAX_MIN
140 #define INTMAX_MAX _PDCLIB_INTMAX_MAX
141 #define UINTMAX_MAX _PDCLIB_UINTMAX_MAX
143 /* 7.18.3 Limits of other integer types */
145 #define PTRDIFF_MIN _PDCLIB_PTRDIFF_MIN
146 #define PTRDIFF_MAX _PDCLIB_PTRDIFF_MAX
148 #define SIG_ATOMIC_MIN _PDCLIB_SIG_ATOMIC_MIN
149 #define SIG_ATOMIC_MAX _PDCLIB_SIG_ATOMIC_MAX
151 #define SIZE_MAX _PDCLIB_SIZE_MAX
153 #define WCHAR_MIN _PDCLIB_WCHAR_MIN
154 #define WCHAR_MAX _PDCLIB_WCHAR_MAX
156 #define WINT_MIN _PDCLIB_WINT_MIN
157 #define WINT_MAX _PDCLIB_WINT_MAX
161 /* 7.18.4 Macros for integer constants */
164 #ifndef __STDC_CONSTANT_MACROS
165 #define _PDCLIB_NO_CONSTANT_MACROS
169 #ifndef _PDCLIB_NO_CONSTANT_MACROS
171 /* 7.18.4.1 Macros for minimum-width integer constants */
173 /* Expand to an integer constant of specified value and type int_leastN_t */
174 #define INT8_C( value ) _PDCLIB_append( value, _PDCLIB_INT8_LITERAL )
175 #define INT16_C( value ) _PDCLIB_append( value, _PDCLIB_INT16_LITERAL )
176 #define INT32_C( value ) _PDCLIB_append( value, _PDCLIB_INT32_LITERAL )
177 #define INT64_C( value ) _PDCLIB_append( value, _PDCLIB_INT64_LITERAL )
179 /* Expand to an integer constant of specified value and type uint_leastN_t */
180 #define UINT8_C( value ) _PDCLIB_append( value, _PDCLIB_UINT8_LITERAL )
181 #define UINT16_C( value ) _PDCLIB_append( value, _PDCLIB_UINT16_LITERAL )
182 #define UINT32_C( value ) _PDCLIB_append( value, _PDCLIB_UINT32_LITERAL )
183 #define UINT64_C( value ) _PDCLIB_append( value, _PDCLIB_UINT64_LITERAL )
185 /* 7.18.4.2 Macros for greatest-width integer constants */
187 /* Expand to an integer constant of specified value and type intmax_t */
188 #define INTMAX_C( value ) _PDCLIB_append( value, _PDCLIB_INTMAX_LITERAL )
190 /* Expand to an integer constant of specified value and type uintmax_t */
191 #define UINTMAX_C( value ) _PDCLIB_append( value, _PDCLIB_UINTMAX_LITERAL )