From 983e1bf095abd3b8a7e1f6ae3a4be654ee3a67e6 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 26 Aug 1993 10:08:37 +0000 Subject: [PATCH] Fix to icompute.c: always had one digit too much --- lang/cem/libcc.ansi/stdio/doprnt.c | 2 +- lang/cem/libcc.ansi/stdio/icompute.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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;