tiny-printf: Improve %X formatting
If tiny printf is used with 0x%08X (upper case X) the output is always 0x00000000. It could be confusing if upper case instead of lower case is used intentionally or accidentally because the actual value is not output. To avoid this confusion, treat output of %X as %x. As a compromise for tiny printf, the hex value is then output correctly, but in lower case. This is done to keep it tiny printf small. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:

committed by
Tom Rini

parent
9d9fbdab0e
commit
51b8679b94
@@ -285,6 +285,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
|
||||
islong = true;
|
||||
/* no break */
|
||||
case 'x':
|
||||
case 'X':
|
||||
if (islong) {
|
||||
num = va_arg(va, unsigned long);
|
||||
div = 1UL << (sizeof(long) * 8 - 4);
|
||||
|
Reference in New Issue
Block a user