From 0527d29da443886d92e9a418180c5b25a5f8d270 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Wed, 18 Oct 1995 08:42:23 +0000 Subject: initial import of NetBSD tree --- src/lib/libc/stdlib/a64l.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/lib/libc/stdlib/a64l.c (limited to 'src/lib/libc/stdlib/a64l.c') diff --git a/src/lib/libc/stdlib/a64l.c b/src/lib/libc/stdlib/a64l.c new file mode 100644 index 0000000000..03fc77e034 --- /dev/null +++ b/src/lib/libc/stdlib/a64l.c @@ -0,0 +1,34 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char *rcsid = "$NetBSD: a64l.c,v 1.3 1995/05/11 23:04:47 jtc Exp $"; +#endif + +long +a64l(s) + const char *s; +{ + long value, digit, shift; + int i; + + value = 0; + shift = 0; + for (i = 0; *s && i < 6; i++, s++) { + if (*s <= '/') + digit = *s - '.'; + else if (*s <= '9') + digit = *s - '0' + 2; + else if (*s <= 'Z') + digit = *s - 'A' + 12; + else + digit = *s - 'a' + 38; + + value |= digit << shift; + shift += 6; + } + + return (long) value; +} -- cgit v1.2.3-55-g6feb