Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
323 B

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