summaryrefslogtreecommitdiff
path: root/firmware/libc/include
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-30 16:00:03 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-30 16:00:03 +0000
commitc0f9aa44e4bdd8c7201b3aeefe423f31e98360bb (patch)
tree24251e386cb62e3da79a3dcc1fd30ceeb2e7a4c6 /firmware/libc/include
parent92961503ff1d01888dc065751bd26819f594df0b (diff)
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/include')
-rw-r--r--firmware/libc/include/inttypes.h74
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 @@
#include <stdint.h>
-/* could possibly have (f)printf format specifies here */
+/* could possibly have (f)scanf format specifiers here */
+
+/* 8 bit */
+#define PRId8 "d"
+#define PRIi8 "d"
+#define PRIu8 "u"
+#define PRIx8 "x"
+#define PRIX8 "X"
+
+/* 16 bit */
+#if USHRT_MAX == 0xffff
+
+#define PRId16 "d"
+#define PRIi16 "d"
+#define PRIu16 "u"
+#define PRIx16 "x"
+#define PRIX16 "X"
+
+#endif
+
+/* 32 bit */
+#if ULONG_MAX == 0xfffffffful
+
+#define PRId32 "ld"
+#define PRIi32 "ld"
+#define PRIu32 "lu"
+#define PRIx32 "lx"
+#define PRIX32 "lX"
+#define PRIdPTR "ld"
+#define PRIiPTR "ld"
+#define PRIuPTR "lu"
+#define PRIxPTR "lx"
+#define PRIXPTR "lX"
+
+#elif UINT_MAX == 0xffffffffu
+
+#define PRId32 "d"
+#define PRIi32 "d"
+#define PRIu32 "u"
+#define PRIx32 "x"
+#define PRIX32 "X"
+
+#endif
+
+/* 64 bit */
+#if ULONG_MAX == 0xffffffffffffffffull
+
+#define PRId64 "ld"
+#define PRIi64 "ld"
+#define PRIu64 "lu"
+#define PRIx64 "lx"
+#define PRIX64 "lX"
+#define PRIdPTR "ld"
+#define PRIiPTR "ld"
+#define PRIuPTR "lu"
+#define PRIxPTR "lx"
+#define PRIXPTR "lX"
+
+
+#else
+
+#define PRId64 "lld"
+#define PRIi64 "lld"
+#define PRIu64 "llu"
+#define PRIx64 "llx"
+#define PRIX64 "llX"
+#define PRIdPTR "lld"
+#define PRIiPTR "lld"
+#define PRIuPTR "llu"
+#define PRIxPTR "llx"
+#define PRIXPTR "llX"
+
+#endif
#endif /* __INTTYPES_H__ */