Remove building with NOCRYPTO option
[minix3.git] / lib / libc / stdlib / a64l.c
blobd7d0042121dea5dea9f11560153aad284c34e393
1 /*
2 * Written by J.T. Conklin <jtc@NetBSD.org>.
3 * Public domain.
4 */
6 #include <sys/cdefs.h>
7 #if defined(LIBC_SCCS) && !defined(lint)
8 __RCSID("$NetBSD: a64l.c,v 1.10 2012/06/08 11:15:26 abs Exp $");
9 #endif
11 #include "namespace.h"
13 #include <assert.h>
14 #include <stdlib.h>
16 #ifdef __weak_alias
17 __weak_alias(a64l,_a64l)
18 #endif
20 long
21 a64l(const char *s)
23 long value, digit, shift;
24 int i;
26 _DIAGASSERT(s != NULL);
28 value = 0;
29 shift = 0;
30 for (i = 0; *s && i < 6; i++, s++) {
31 if (*s <= '/')
32 digit = *s - '.';
33 else if (*s <= '9')
34 digit = *s - '0' + 2;
35 else if (*s <= 'Z')
36 digit = *s - 'A' + 12;
37 else
38 digit = *s - 'a' + 38;
40 value |= digit << shift;
41 shift += 6;
44 return (long) value;