Fix printing of 64-bit decimal values specified by "%lld" in format

identifier.
This commit is contained in:
Jan Stoess 2012-09-12 16:37:18 +02:00
parent 0737eccd40
commit 1ae3d58bff
1 changed files with 17 additions and 7 deletions

View File

@ -341,13 +341,23 @@ int SECTION(SEC_KDEBUG) do_printf(const char* format_p, va_list args)
}
case 'd':
{
long val = arg(long);
if (val < 0)
{
putc('-');
val = -val;
}
n += print_dec(val, width, nullpad ? '0' : ' ');
if (longs < 2) {
long val = arg(long);
if (val < 0)
{
putc('-');
val = -val;
}
n += print_dec(val, width, nullpad ? '0' : ' ');
} else {
u64_t val = arg(u64_t);
if (val < 0)
{
putc('-');
val = -val;
}
n += print_dec64(val, width, nullpad ? '0' : ' ');
}
break;
}
case 'u':