From: Marek Vasut Date: Fri, 10 Apr 2020 18:54:49 +0000 (+0200) Subject: tiny-printf: Support %i X-Git-Tag: v2020.07-rc2~20^2~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e7882f65f02eca5a7d35871ba0355462bbf7362e;p=oweals%2Fu-boot.git 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 Cc: Simon Glass Cc: Stefan Roese --- diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index 1138c7012a..8fc7e48d99 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -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, '-');