scan_ulong.c (361B)
1 /* Public domain. */ 2 3 #include "scan.h" 4 5 unsigned int scan_ulong(register const char *s,register unsigned long *u) 6 { 7 register unsigned int pos = 0; 8 register unsigned long result = 0; 9 register unsigned long c; 10 while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10) { 11 result = result * 10 + c; 12 ++pos; 13 } 14 *u = result; 15 return pos; 16 }