tiny-printf: Support %i

The most basic printf("%i", value) formating string was missing,
add it for the sake of convenience.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
This commit is contained in:
Marek Vasut 2020-04-10 20:54:49 +02:00 committed by Tom Rini
parent b641dd3ec8
commit e7882f65f0

View File

@ -242,6 +242,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
goto abort;
case 'u':
case 'd':
case 'i':
div = 1000000000;
if (islong) {
num = va_arg(va, unsigned long);
@ -251,7 +252,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
num = va_arg(va, unsigned int);
}
if (ch == 'd') {
if (ch != 'u') {
if (islong && (long)num < 0) {
num = -(long)num;
out(info, '-');