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.
14 lines
314 B
14 lines
314 B
9 years ago
|
#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;
|
||
|
}
|