From f9be9dc5be10570922349171a532ce1904d012ed Mon Sep 17 00:00:00 2001 From: Bartek Szatkowski Date: Wed, 19 Feb 2020 11:40:16 +0000 Subject: [PATCH] minimal-printf: Explicitly print %ll[diuxX] when 64b disabled --- .../mbed_printf_implementation.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/platform/source/minimal-printf/mbed_printf_implementation.c b/platform/source/minimal-printf/mbed_printf_implementation.c index ebe665e595..aa47400495 100644 --- a/platform/source/minimal-printf/mbed_printf_implementation.c +++ b/platform/source/minimal-printf/mbed_printf_implementation.c @@ -502,6 +502,16 @@ int mbed_minimal_formatted_string(char *buffer, size_t length, const char *forma /* use 64 bit storage type for readout */ value = va_arg(arguments, MBED_SIGNED_STORAGE); } else +#else + /* If 64 bit is not enabled, print %ll[di] rather than truncated value */ + if (length_modifier == LENGTH_LL) { + mbed_minimal_formatted_string_character(buffer, length, &result, '%', stream); + if (next == '%') { + // Continue printing loop after `%` + index = next_index; + } + continue; + } #endif { /* use native storage type (which can be 32 or 64 bit) */ @@ -551,6 +561,16 @@ int mbed_minimal_formatted_string(char *buffer, size_t length, const char *forma /* use 64 bit storage type for readout */ value = va_arg(arguments, MBED_UNSIGNED_STORAGE); } else +#else + /* If 64 bit is not enabled, print %ll[uxX] rather than truncated value */ + if (length_modifier == LENGTH_LL) { + mbed_minimal_formatted_string_character(buffer, length, &result, '%', stream); + if (next == '%') { + // Continue printing loop after `%` + index = next_index; + } + continue; + } #endif { /* use native storage type (which can be 32 or 64 bit) */