source: asp3_tinet_ecnl_arm/trunk/musl-1.1.18/src/misc/a64l.c@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 499 bytes
Line 
1#include <stdlib.h>
2#include <string.h>
3#include <stdint.h>
4
5static const char digits[] =
6 "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
7
8long a64l(const char *s)
9{
10 int e;
11 uint32_t x = 0;
12 for (e=0; e<36 && *s; e+=6, s++) {
13 const char *d = strchr(digits, *s);
14 if (!d) break;
15 x |= (uint32_t)(d-digits)<<e;
16 }
17 return (int32_t)x;
18}
19
20char *l64a(long x0)
21{
22 static char s[7];
23 char *p;
24 uint32_t x = x0;
25 for (p=s; x; p++, x>>=6)
26 *p = digits[x&63];
27 *p = 0;
28 return s;
29}
Note: See TracBrowser for help on using the repository browser.