Fix to icompute.c: always had one digit too much

This commit is contained in:
ceriel 1993-08-26 10:08:37 +00:00
parent b3863b7247
commit 983e1bf095
2 changed files with 2 additions and 2 deletions

View file

@ -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; 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') if (c == 'X')
while (old_s != s) { while (old_s != s) {

View file

@ -14,7 +14,7 @@ _i_compute(unsigned long val, int base, char *s, int nrdigits)
c= val % base ; c= val % base ;
val /= base ; val /= base ;
if (val || nrdigits > 0) if (val || nrdigits > 1)
s = _i_compute(val, base, s, nrdigits - 1); s = _i_compute(val, base, s, nrdigits - 1);
*s++ = (c>9 ? c-10+'a' : c+'0'); *s++ = (c>9 ? c-10+'a' : c+'0');
return s; return s;