]> jfr.im git - irc/quakenet/newserv.git/blob - lib/base64.h
Initial Import
[irc/quakenet/newserv.git] / lib / base64.h
1 /* base64.h:
2 *
3 * Definitions of the base64 functions
4 */
5
6 #ifndef __BASE64_H
7 #define __BASE64_H
8
9 extern int numerictab[];
10
11 /*
12 #define numerictolong(x,y) (donumtolong(x,y,0))
13 #define donumtolong(x,y,z) ((y)==0?(z):(donumtolong((x)+1,(y)-1,((z)<<6)+numerictab[(int)*(x)])))
14 */
15
16 /* Function defined here for speed.. */
17 static long numerictolong(const char *numeric, int numericlen)
18 {
19 long mynumeric=0;
20 int i;
21
22 for (i=0;i<numericlen;i++) {
23 mynumeric=(mynumeric << 6)+numerictab[(int) *(numeric++)];
24 }
25
26 return mynumeric;
27 }
28
29 /* long numerictolong(const char *numeric, int numericlen); */
30 char *longtonumeric(long param, int len);
31 char *longtonumeric2(long param, int len, char *mynum);
32 #endif