Skip to content

Commit f9be9dc

Browse files
committed
minimal-printf: Explicitly print %ll[diuxX] when 64b disabled
1 parent 554a04b commit f9be9dc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

platform/source/minimal-printf/mbed_printf_implementation.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,16 @@ int mbed_minimal_formatted_string(char *buffer, size_t length, const char *forma
502502
/* use 64 bit storage type for readout */
503503
value = va_arg(arguments, MBED_SIGNED_STORAGE);
504504
} else
505+
#else
506+
/* If 64 bit is not enabled, print %ll[di] rather than truncated value */
507+
if (length_modifier == LENGTH_LL) {
508+
mbed_minimal_formatted_string_character(buffer, length, &result, '%', stream);
509+
if (next == '%') {
510+
// Continue printing loop after `%`
511+
index = next_index;
512+
}
513+
continue;
514+
}
505515
#endif
506516
{
507517
/* 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
551561
/* use 64 bit storage type for readout */
552562
value = va_arg(arguments, MBED_UNSIGNED_STORAGE);
553563
} else
564+
#else
565+
/* If 64 bit is not enabled, print %ll[uxX] rather than truncated value */
566+
if (length_modifier == LENGTH_LL) {
567+
mbed_minimal_formatted_string_character(buffer, length, &result, '%', stream);
568+
if (next == '%') {
569+
// Continue printing loop after `%`
570+
index = next_index;
571+
}
572+
continue;
573+
}
554574
#endif
555575
{
556576
/* use native storage type (which can be 32 or 64 bit) */

0 commit comments

Comments
 (0)