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.
libowfat/fmt/fmt_8long.c

14 lines
323 B
C

23 years ago
#include "fmt.h"
size_t fmt_8long(char *dest,unsigned long i) {
23 years ago
register unsigned long len,tmp;
/* first count the number of bytes needed */
for (len=1, tmp=i; tmp>7; ++len) tmp>>=3;
23 years ago
if (dest)
22 years ago
for (tmp=i, dest+=len; ; ) {
*--dest = (char)((tmp&7)+'0');
22 years ago
if (!(tmp>>=3)) break;
}
23 years ago
return len;
}