diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-30 16:00:03 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-30 16:00:03 +0000 |
commit | c0f9aa44e4bdd8c7201b3aeefe423f31e98360bb (patch) | |
tree | 24251e386cb62e3da79a3dcc1fd30ceeb2e7a4c6 /firmware/libc | |
parent | 92961503ff1d01888dc065751bd26819f594df0b (diff) | |
download | rockbox-c0f9aa44e4bdd8c7201b3aeefe423f31e98360bb.tar.gz rockbox-c0f9aa44e4bdd8c7201b3aeefe423f31e98360bb.zip |
inttypes.h: add (some) iso c99 fprintf format specifiers
Skipped the specifiers for octal, (u)int_leastN_t, (u)int_fastN_t and
(u)intmax_t as we don't use them in rockbox
Specifiers use the types specified in stdint.h
Specifiers for short (16 bits) and char (8 bits) use the int specifier,
our format.c doesn't know about 'h' and 'hh'
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26411 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/libc')
-rw-r--r-- | firmware/libc/include/inttypes.h | 74 |
1 files changed, 73 insertions, 1 deletions
diff --git a/firmware/libc/include/inttypes.h b/firmware/libc/include/inttypes.h index c03609c6d8..ff4027f17c 100644 --- a/firmware/libc/include/inttypes.h +++ b/firmware/libc/include/inttypes.h | |||
@@ -24,6 +24,78 @@ | |||
24 | 24 | ||
25 | #include <stdint.h> | 25 | #include <stdint.h> |
26 | 26 | ||
27 | /* could possibly have (f)printf format specifies here */ | 27 | /* could possibly have (f)scanf format specifiers here */ |
28 | |||
29 | /* 8 bit */ | ||
30 | #define PRId8 "d" | ||
31 | #define PRIi8 "d" | ||
32 | #define PRIu8 "u" | ||
33 | #define PRIx8 "x" | ||
34 | #define PRIX8 "X" | ||
35 | |||
36 | /* 16 bit */ | ||
37 | #if USHRT_MAX == 0xffff | ||
38 | |||
39 | #define PRId16 "d" | ||
40 | #define PRIi16 "d" | ||
41 | #define PRIu16 "u" | ||
42 | #define PRIx16 "x" | ||
43 | #define PRIX16 "X" | ||
44 | |||
45 | #endif | ||
46 | |||
47 | /* 32 bit */ | ||
48 | #if ULONG_MAX == 0xfffffffful | ||
49 | |||
50 | #define PRId32 "ld" | ||
51 | #define PRIi32 "ld" | ||
52 | #define PRIu32 "lu" | ||
53 | #define PRIx32 "lx" | ||
54 | #define PRIX32 "lX" | ||
55 | #define PRIdPTR "ld" | ||
56 | #define PRIiPTR "ld" | ||
57 | #define PRIuPTR "lu" | ||
58 | #define PRIxPTR "lx" | ||
59 | #define PRIXPTR "lX" | ||
60 | |||
61 | #elif UINT_MAX == 0xffffffffu | ||
62 | |||
63 | #define PRId32 "d" | ||
64 | #define PRIi32 "d" | ||
65 | #define PRIu32 "u" | ||
66 | #define PRIx32 "x" | ||
67 | #define PRIX32 "X" | ||
68 | |||
69 | #endif | ||
70 | |||
71 | /* 64 bit */ | ||
72 | #if ULONG_MAX == 0xffffffffffffffffull | ||
73 | |||
74 | #define PRId64 "ld" | ||
75 | #define PRIi64 "ld" | ||
76 | #define PRIu64 "lu" | ||
77 | #define PRIx64 "lx" | ||
78 | #define PRIX64 "lX" | ||
79 | #define PRIdPTR "ld" | ||
80 | #define PRIiPTR "ld" | ||
81 | #define PRIuPTR "lu" | ||
82 | #define PRIxPTR "lx" | ||
83 | #define PRIXPTR "lX" | ||
84 | |||
85 | |||
86 | #else | ||
87 | |||
88 | #define PRId64 "lld" | ||
89 | #define PRIi64 "lld" | ||
90 | #define PRIu64 "llu" | ||
91 | #define PRIx64 "llx" | ||
92 | #define PRIX64 "llX" | ||
93 | #define PRIdPTR "lld" | ||
94 | #define PRIiPTR "lld" | ||
95 | #define PRIuPTR "llu" | ||
96 | #define PRIxPTR "llx" | ||
97 | #define PRIXPTR "llX" | ||
98 | |||
99 | #endif | ||
28 | 100 | ||
29 | #endif /* __INTTYPES_H__ */ | 101 | #endif /* __INTTYPES_H__ */ |