diff options
Diffstat (limited to 'sprintf.c')
-rw-r--r-- | sprintf.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -18,6 +18,8 @@ #include <math.h> #define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */ +#define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT) +#define EXTENDSIGN(n, l) (((~0 << (n)) >> (((n)*(l)) % BITSPERDIG)) & ~(~0 << (n))) static void fmt_setup _((char*,int,int,int,int)); @@ -36,7 +38,7 @@ remove_sign_bits(str, base) } } else if (base == 8) { - if (*t == '3') t++; + *t |= EXTENDSIGN(3, strlen(t)); while (*t == '7') { t++; } |