]> jfr.im git - irc/quakenet/newserv.git/blame - lib/base64.h
review - ops first
[irc/quakenet/newserv.git] / lib / base64.h
CommitLineData
c86edd1d
Q
1/* base64.h:
2 *
3 * Definitions of the base64 functions
4 */
5
6#ifndef __BASE64_H
7#define __BASE64_H
8
9extern 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.. */
4ad1cf7a
CP
17/* slug -- these warnings were getting irritating, since we're on C99 we can now use __inline__ */
18
19/*
c86edd1d
Q
20static 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}
4ad1cf7a
CP
31*/
32
6c27603e
CP
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
45INLINE long numerictolong(const char *numeric, int numericlen);
c86edd1d
Q
46char *longtonumeric(long param, int len);
47char *longtonumeric2(long param, int len, char *mynum);
48#endif