From 220534453eecc2c07ad710d72268aafd20b83138 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 8 May 2015 23:07:47 -0400 Subject: initial commit --- scan_ulong.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scan_ulong.c (limited to 'scan_ulong.c') diff --git a/scan_ulong.c b/scan_ulong.c new file mode 100644 index 0000000..af19701 --- /dev/null +++ b/scan_ulong.c @@ -0,0 +1,16 @@ +/* Public domain. */ + +#include "scan.h" + +unsigned int scan_ulong(register const char *s,register unsigned long *u) +{ + register unsigned int pos = 0; + register unsigned long result = 0; + register unsigned long c; + while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10) { + result = result * 10 + c; + ++pos; + } + *u = result; + return pos; +} -- cgit v1.2.3