fmt_ulong did not output '0' properly.
parent
9a01871387
commit
762298de12
@ -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…
Reference in New Issue