diff --git a/lang/cem/libcc.ansi/stdio/doprnt.c b/lang/cem/libcc.ansi/stdio/doprnt.c index b520dcfbf..309505958 100644 --- a/lang/cem/libcc.ansi/stdio/doprnt.c +++ b/lang/cem/libcc.ansi/stdio/doprnt.c @@ -100,7 +100,7 @@ o_print(va_list *ap, int flags, char *s, char c, int precision, int is_signed) case 'p': base = 16; break; } - s = _i_compute(unsigned_val, base, s, precision - 1); + s = _i_compute(unsigned_val, base, s, precision); if (c == 'X') while (old_s != s) { diff --git a/lang/cem/libcc.ansi/stdio/icompute.c b/lang/cem/libcc.ansi/stdio/icompute.c index 3787772e7..5e7fa80f6 100644 --- a/lang/cem/libcc.ansi/stdio/icompute.c +++ b/lang/cem/libcc.ansi/stdio/icompute.c @@ -14,7 +14,7 @@ _i_compute(unsigned long val, int base, char *s, int nrdigits) c= val % base ; val /= base ; - if (val || nrdigits > 0) + if (val || nrdigits > 1) s = _i_compute(val, base, s, nrdigits - 1); *s++ = (c>9 ? c-10+'a' : c+'0'); return s;