4 #define between(x,min,max) (((min-1-x) & (x-max-1))>>8)
11 c = between(o, 0, 25) & ('A'+o);
12 c |= between(o, 26, 51) & ('a'+(o-26));
13 c |= between(o, 52, 61) & ('0'+(o-52));
14 c |= between(o, 62, 62) & ('+');
15 c |= between(o, 63, 63) & ('/');
24 o = between(c, 'A', 'Z') & (1+(c-'A'));
25 o |= between(c, 'a', 'z') & (1+26+(c-'a'));
26 o |= between(c, '0', '9') & (1+52+(c-'0'));
27 o |= between(c, '+', '+') & (1+62);
28 o |= between(c, '/', '/') & (1+63);
33 dec64x(uchar *out, int lim, char *in, int n, int (*chr)(int))
87 enc64x(char *out, int lim, uchar *in, int n, int (*chr)(int))
94 for(i = n/3; i > 0; i--){
100 *out++ = chr(b24>>18);
101 *out++ = chr((b24>>12)&0x3f);
102 *out++ = chr((b24>>6)&0x3f);
103 *out++ = chr(b24&0x3f);
112 *out++ = chr(b24>>18);
113 *out++ = chr((b24>>12)&0x3f);
114 *out++ = chr((b24>>6)&0x3f);
121 *out++ = chr(b24>>18);
122 *out++ = chr((b24>>12)&0x3f);
133 enc64(char *out, int lim, uchar *in, int n)
135 return enc64x(out, lim, in, n, enc64chr);
139 dec64(uchar *out, int lim, char *in, int n)
141 return dec64x(out, lim, in, n, dec64chr);