From 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 12 Feb 2011 00:22:29 -0500 Subject: initial check-in, version 0.5.0 --- src/stdlib/atoll.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/stdlib/atoll.c (limited to 'src/stdlib/atoll.c') diff --git a/src/stdlib/atoll.c b/src/stdlib/atoll.c new file mode 100644 index 00000000..0e03e0a1 --- /dev/null +++ b/src/stdlib/atoll.c @@ -0,0 +1,16 @@ +#include +#include + +long long atoll(const char *s) +{ + long long n=0; + int neg=0; + while (isspace(*s)) s++; + switch (*s) { + case '-': neg=1; + case '+': s++; + } + while (isdigit(*s)) + n = 10*n + *s++ - '0'; + return neg ? -n : n; +} -- cgit v1.2.1