1 | /* |
---|
2 | * COPYRIGHT (c) 2004. |
---|
3 | * Ralf Corsepius, Ulm/Germany. |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.org/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef __rtems_inttypes_h |
---|
13 | #define __rtems_inttypes_h |
---|
14 | |
---|
15 | #include <sys/_stdint.h> |
---|
16 | |
---|
17 | #define __STRINGIFY(a) #a |
---|
18 | |
---|
19 | /* 8-bit types */ |
---|
20 | #define __PRI8(x) __STRINGIFY(x) |
---|
21 | |
---|
22 | #define PRId8 __PRI8(d) |
---|
23 | #define PRIi8 __PRI8(i) |
---|
24 | #define PRIo8 __PRI8(o) |
---|
25 | #define PRIu8 __PRI8(u) |
---|
26 | #define PRIx8 __PRI8(x) |
---|
27 | #define PRIX8 __PRI8(X) |
---|
28 | |
---|
29 | #define PRIdLEAST8 __PRI8(d) |
---|
30 | #define PRIiLEAST8 __PRI8(i) |
---|
31 | #define PRIoLEAST8 __PRI8(o) |
---|
32 | #define PRIuLEAST8 __PRI8(u) |
---|
33 | #define PRIxLEAST8 __PRI8(x) |
---|
34 | #define PRIXLEAST8 __PRI8(X) |
---|
35 | |
---|
36 | #define PRIdFAST8 __PRI8(d) |
---|
37 | #define PRIiFAST8 __PRI8(i) |
---|
38 | #define PRIoFAST8 __PRI8(o) |
---|
39 | #define PRIuFAST8 __PRI8(u) |
---|
40 | #define PRIxFAST8 __PRI8(x) |
---|
41 | #define PRIXFAST8 __PRI8(X) |
---|
42 | |
---|
43 | /* 16-bit types */ |
---|
44 | #define __PRI16(x) __STRINGIFY(x) |
---|
45 | |
---|
46 | #define PRId16 __PRI16(d) |
---|
47 | #define PRIi16 __PRI16(i) |
---|
48 | #define PRIo16 __PRI16(o) |
---|
49 | #define PRIu16 __PRI16(u) |
---|
50 | #define PRIx16 __PRI16(x) |
---|
51 | #define PRIX16 __PRI16(X) |
---|
52 | |
---|
53 | #define PRIdLEAST16 __PRI16(d) |
---|
54 | #define PRIiLEAST16 __PRI16(i) |
---|
55 | #define PRIoLEAST16 __PRI16(o) |
---|
56 | #define PRIuLEAST16 __PRI16(u) |
---|
57 | #define PRIxLEAST16 __PRI16(x) |
---|
58 | #define PRIXLEAST16 __PRI16(X) |
---|
59 | |
---|
60 | #define PRIdFAST16 __PRI16(d) |
---|
61 | #define PRIiFAST16 __PRI16(i) |
---|
62 | #define PRIoFAST16 __PRI16(o) |
---|
63 | #define PRIuFAST16 __PRI16(u) |
---|
64 | #define PRIxFAST16 __PRI16(x) |
---|
65 | #define PRIXFAST16 __PRI16(X) |
---|
66 | |
---|
67 | /* 32-bit types */ |
---|
68 | #if defined(__rtems_long32) |
---|
69 | #define __PRI32(x) __STRINGIFY(l##x) |
---|
70 | #else |
---|
71 | #define __PRI32(x) __STRINGIFY(x) |
---|
72 | #endif |
---|
73 | |
---|
74 | #define PRId32 __PRI32(d) |
---|
75 | #define PRIi32 __PRI32(i) |
---|
76 | #define PRIo32 __PRI32(o) |
---|
77 | #define PRIu32 __PRI32(u) |
---|
78 | #define PRIx32 __PRI32(x) |
---|
79 | #define PRIX32 __PRI32(X) |
---|
80 | |
---|
81 | #define PRIdLEAST32 __PRI32(d) |
---|
82 | #define PRIiLEAST32 __PRI32(i) |
---|
83 | #define PRIoLEAST32 __PRI32(o) |
---|
84 | #define PRIuLEAST32 __PRI32(u) |
---|
85 | #define PRIxLEAST32 __PRI32(x) |
---|
86 | #define PRIXLEAST32 __PRI32(X) |
---|
87 | |
---|
88 | #define PRIdFAST32 __PRI32(d) |
---|
89 | #define PRIiFAST32 __PRI32(i) |
---|
90 | #define PRIoFAST32 __PRI32(o) |
---|
91 | #define PRIuFAST32 __PRI32(u) |
---|
92 | #define PRIxFAST32 __PRI32(x) |
---|
93 | #define PRIXFAST32 __PRI32(X) |
---|
94 | |
---|
95 | /* 64-bit types */ |
---|
96 | #if defined(__rtems_longlong64) |
---|
97 | #define __PRI64(x) __STRINGIFY(ll##x) |
---|
98 | #elif defined(__rtems_long64) |
---|
99 | #define __PRI64(x) __STRINGIFY(l##x) |
---|
100 | #else |
---|
101 | #define __PRI64(x) __STRINGIFY(x) |
---|
102 | #endif |
---|
103 | |
---|
104 | #define PRId64 __PRI64(d) |
---|
105 | #define PRIi64 __PRI64(i) |
---|
106 | #define PRIo64 __PRI64(o) |
---|
107 | #define PRIu64 __PRI64(u) |
---|
108 | #define PRIx64 __PRI64(x) |
---|
109 | #define PRIX64 __PRI64(X) |
---|
110 | |
---|
111 | #define PRIdLEAST64 __PRI64(d) |
---|
112 | #define PRIiLEAST64 __PRI64(i) |
---|
113 | #define PRIoLEAST64 __PRI64(o) |
---|
114 | #define PRIuLEAST64 __PRI64(u) |
---|
115 | #define PRIxLEAST64 __PRI64(x) |
---|
116 | #define PRIXLEAST64 __PRI64(X) |
---|
117 | |
---|
118 | #define PRIdFAST64 __PRI64(d) |
---|
119 | #define PRIiFAST64 __PRI64(i) |
---|
120 | #define PRIoFAST64 __PRI64(o) |
---|
121 | #define PRIuFAST64 __PRI64(u) |
---|
122 | #define PRIxFAST64 __PRI64(x) |
---|
123 | #define PRIXFAST64 __PRI64(X) |
---|
124 | |
---|
125 | /* max-bit types */ |
---|
126 | #if defined(__rtems_longlong64) |
---|
127 | #define __PRIMAX(x) __STRINGIFY(ll##x) |
---|
128 | #elif defined(__rtems_long64) |
---|
129 | #define __PRIMAX(x) __STRINGIFY(l##x) |
---|
130 | #else |
---|
131 | #define __PRIMAX(x) __STRINGIFY(x) |
---|
132 | #endif |
---|
133 | |
---|
134 | #define PRIdMAX __PRIMAX(d) |
---|
135 | #define PRIiMAX __PRIMAX(i) |
---|
136 | #define PRIoMAX __PRIMAX(o) |
---|
137 | #define PRIuMAX __PRIMAX(u) |
---|
138 | #define PRIxMAX __PRIMAX(x) |
---|
139 | #define PRIXMAX __PRIMAX(X) |
---|
140 | |
---|
141 | /* ptr types */ |
---|
142 | #if defined(__rtems_longlong64) |
---|
143 | #define __PRIPTR(x) __STRINGIFY(ll##x) |
---|
144 | #elif defined(__rtems_long64) |
---|
145 | #define __PRIPTR(x) __STRINGIFY(l##x) |
---|
146 | #else |
---|
147 | #define __PRIPTR(x) __STRINGIFY(x) |
---|
148 | #endif |
---|
149 | |
---|
150 | #define PRIdPTR __PRIPTR(d) |
---|
151 | #define PRIiPTR __PRIPTR(i) |
---|
152 | #define PRIoPTR __PRIPTR(o) |
---|
153 | #define PRIuPTR __PRIPTR(u) |
---|
154 | #define PRIxPTR __PRIPTR(x) |
---|
155 | #define PRIXPTR __PRIPTR(X) |
---|
156 | |
---|
157 | typedef struct { |
---|
158 | intmax_t quot; |
---|
159 | intmax_t rem; |
---|
160 | } imaxdiv_t; |
---|
161 | |
---|
162 | #ifdef __cplusplus |
---|
163 | extern "C" { |
---|
164 | #endif |
---|
165 | |
---|
166 | extern intmax_t imaxabs(intmax_t j); |
---|
167 | extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denomer); |
---|
168 | extern intmax_t strtoimax(const char *__restrict, char **__restrict, int); |
---|
169 | extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int); |
---|
170 | extern intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int); |
---|
171 | extern uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int); |
---|
172 | |
---|
173 | #ifdef __cplusplus |
---|
174 | } |
---|
175 | #endif |
---|
176 | |
---|
177 | #endif /* __rtems_inttypes_h */ |
---|