1993-10-22 20:26:43 +03:00
|
|
|
/*
|
1995-05-12 03:03:44 +04:00
|
|
|
* Written by J.T. Conklin <jtc@netbsd.org>.
|
|
|
|
* Public domain.
|
1993-10-22 20:26:43 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(LIBC_SCCS) && !defined(lint)
|
1995-05-12 03:03:44 +04:00
|
|
|
static char *rcsid = "$NetBSD: a64l.c,v 1.3 1995/05/11 23:03:44 jtc Exp $";
|
1993-10-22 20:26:43 +03:00
|
|
|
#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;
|
|
|
|
}
|