Fix PrintfTraits print out
newlib only supports a subset of GCC string format specifiers. Update
the PrintfTraits so it actually print the formatted value.
Change-Id: I7c363614897b6136730d83475a0518b7fe34d329
diff --git a/crt/printf_traits.h b/crt/printf_traits.h
index 14be9bc..bf1dc68 100644
--- a/crt/printf_traits.h
+++ b/crt/printf_traits.h
@@ -29,13 +29,13 @@
template <>
struct PrintfTraits<int8_t> {
static constexpr const char* kFmt = "%d";
- static constexpr const char* kFmtHex = "0x%hhx";
+ static constexpr const char* kFmtHex = "0x%02x";
};
template <>
struct PrintfTraits<int16_t> {
- static constexpr const char* kFmt = "%hd";
- static constexpr const char* kFmtHex = "0x%hx";
+ static constexpr const char* kFmt = "%d";
+ static constexpr const char* kFmtHex = "0x%04x";
};
template <>
@@ -47,13 +47,13 @@
template <>
struct PrintfTraits<uint8_t> {
static constexpr const char* kFmt = "%u";
- static constexpr const char* kFmtHex = "0x%hhx";
+ static constexpr const char* kFmtHex = "0x%02x";
};
template <>
struct PrintfTraits<uint16_t> {
- static constexpr const char* kFmt = "%hu";
- static constexpr const char* kFmtHex = "0x%hx";
+ static constexpr const char* kFmt = "%u";
+ static constexpr const char* kFmtHex = "0x%04x";
};
template <>