printing 0 bug fix

This commit is contained in:
bumbread 2022-07-19 09:21:36 +11:00
parent 951eef6af6
commit f94ef2da9e
1 changed files with 2 additions and 2 deletions

View File

@ -426,7 +426,7 @@ static inline int pfx(_ntoa)(
// Remove hash flag for 0 values
if(value == 0) flags &= ~FLAG_HASH;
// Write digits to buffer in reverse (starting from least significant)
while(value) {
do {
int d = (int)(value%base);
value /= base;
if(d < 10)
@ -435,7 +435,7 @@ static inline int pfx(_ntoa)(
d += 'A' - 10;
else d += 'a' - 10;
digits[ndigits++] = d;
}
} while(value);
// Figure out the length of the prefix (part of number before digit stirng)
int pref_len = 0;
if(flags & FLAG_HASH) pref_len = base == 8? 1 : 2;