]> jfr.im git - irc/quakenet/newserv.git/blob - lib/base64.h
r646@blue (orig r494): slug | 2006-05-15 23:35:33 +0100
[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 /* slug -- these warnings were getting irritating, since we're on C99 we can now use __inline__ */
18
19 /*
20 static long numerictolong(const char *numeric, int numericlen)
21 {
22 long mynumeric=0;
23 int i;
24
25 for (i=0;i<numericlen;i++) {
26 mynumeric=(mynumeric << 6)+numerictab[(int) *(numeric++)];
27 }
28
29 return mynumeric;
30 }
31 */
32
33 #ifdef __GNUC__
34 #define INLINE __attribute((always_inline)) inline
35 #endif
36
37 #ifdef _MSC_VER
38 #define INLINE __forceinline
39 #endif
40
41 #ifndef INLINE
42 #define INLINE inline
43 #endif
44
45 INLINE long numerictolong(const char *numeric, int numericlen);
46 char *longtonumeric(long param, int len);
47 char *longtonumeric2(long param, int len, char *mynum);
48 #endif