fmt_ulong did not output '0' properly.

master
leitner 24 years ago
parent 9a01871387
commit 762298de12

@ -1,5 +1,6 @@
0.6: 0.6:
changed name to libowfat changed name to libowfat
fixed fmt_ulong (did not output 0 correctly)
0.5: 0.5:
made subdirectories for the different libraries. made subdirectories for the different libraries.

@ -1,11 +1,11 @@
#include "fmt.h" #include "fmt.h"
unsigned int fmt_ulong(char *dest,unsigned long i) { unsigned int fmt_ulong(char *dest,unsigned long i) {
register unsigned long len,tmp; register unsigned long len,tmp,len2;
/* first count the number of bytes needed */ /* first count the number of bytes needed */
for (len=1, tmp=i; tmp>9; ++len) tmp/=10; for (len=1, tmp=i; tmp>9; ++len) tmp/=10;
if (dest) if (dest)
for (tmp=i, dest+=len; tmp; tmp/=10) for (tmp=i, dest+=len, len2=len+1; --len2; tmp/=10)
*--dest = (tmp%10)+'0'; *--dest = (tmp%10)+'0';
return len; return len;
} }

Loading…
Cancel
Save