You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
352 B
C
15 lines
352 B
C
#include "fmt.h"
|
|
|
|
unsigned int fmt_8longlong(char *dest,unsigned long long i) {
|
|
register unsigned long len;
|
|
unsigned long long tmp;
|
|
/* first count the number of bytes needed */
|
|
for (len=1, tmp=i; tmp>7; ++len) tmp>>=3;
|
|
if (dest)
|
|
for (tmp=i, dest+=len; ; ) {
|
|
*--dest = (tmp&7)+'0';
|
|
if (!(tmp>>=3)) break;
|
|
}
|
|
return len;
|
|
}
|