diff options
author | 1995-10-18 08:37:01 +0000 | |
---|---|---|
committer | 1995-10-18 08:37:01 +0000 | |
commit | df930be708d50e9715f173caa26ffe1b7599b157 (patch) | |
tree | aa317e49e28cb999c9cf3db7f00c20903fe6010a /lib/libc/stdlib/a64l.c | |
download | wireguard-openbsd-df930be708d50e9715f173caa26ffe1b7599b157.tar.xz wireguard-openbsd-df930be708d50e9715f173caa26ffe1b7599b157.zip |
initial import of NetBSD tree
Diffstat (limited to 'lib/libc/stdlib/a64l.c')
-rw-r--r-- | lib/libc/stdlib/a64l.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/libc/stdlib/a64l.c b/lib/libc/stdlib/a64l.c new file mode 100644 index 00000000000..03fc77e034f --- /dev/null +++ b/lib/libc/stdlib/a64l.c @@ -0,0 +1,34 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * 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; +} |