From: Rich Felker Date: Fri, 2 Mar 2012 04:43:31 +0000 (-0500) Subject: implement a64l and l64a (legacy xsi stuff) X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=ca19774c913739ef2bea9586a847d8719f19840f implement a64l and l64a (legacy xsi stuff) --- diff --git a/src/misc/a64l.c b/src/misc/a64l.c new file mode 100644 index 00000000..86aeefe0 --- /dev/null +++ b/src/misc/a64l.c @@ -0,0 +1,26 @@ +#include +#include +#include + +static const char digits[] = + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +long a64l(const char *s) +{ + int e; + uint32_t x = 0; + for (e=0; e<36 && *s; e+=6, s++) + x |= (strchr(digits, *s)-digits)<>=6) + *p = digits[x&63]; + *p = 0; + return s; +}