Permalink
Fetching contributors…
Cannot retrieve contributors at this time
14 lines (12 sloc) 310 Bytes
#include "fmt.h"
unsigned int fmt_ulong(register char *s,register unsigned long u)
{
register unsigned int len; register unsigned long q;
len = 1; q = u;
while (q > 9) { ++len; q /= 10; }
if (s) {
s += len;
do { *--s = '0' + (u % 10); u /= 10; } while(u); /* handles u == 0 */
}
return len;
}