fix outputting 0.

master
leitner 24 years ago
parent 5c1abf12b5
commit 6eca5174a8

@ -5,7 +5,9 @@ unsigned int fmt_8long(char *dest,unsigned long i) {
/* first count the number of bytes needed */ /* first count the number of bytes needed */
for (len=1, tmp=i; tmp>7; ++len) tmp/=8; for (len=1, tmp=i; tmp>7; ++len) tmp/=8;
if (dest) if (dest)
for (tmp=i, dest+=len; tmp; tmp/=8) for (tmp=i, dest+=len; ; ) {
*--dest = (tmp&7)+'0'; *--dest = (tmp&7)+'0';
if (!(tmp>>=3)) break;
}
return len; return len;
} }

@ -9,7 +9,9 @@ unsigned int fmt_xlong(char *dest,unsigned long i) {
/* first count the number of bytes needed */ /* first count the number of bytes needed */
for (len=1, tmp=i; tmp>15; ++len) tmp>>=4; for (len=1, tmp=i; tmp>15; ++len) tmp>>=4;
if (dest) if (dest)
for (tmp=i, dest+=len; tmp; tmp>>=4) for (tmp=i, dest+=len; ; ) {
*--dest = tohex(tmp&15); *--dest = tohex(tmp&15);
if (!(tmp>>=4)) break;
}
return len; return len;
} }

Loading…
Cancel
Save