summaryrefslogtreecommitdiffstats
path: root/debian/htdig/htdig-3.2.0b6/htlib/libdefs.h
blob: e4f1d11cee1bd1b47e9465a5bd126b0a8eb315cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef LIBDEFS_H
#define LIBDEFS_H

/*
   {{{ includes 
 */


#ifdef _MSC_VER /* _WIN32 */
#include <windows.h>
#endif


#include "htconfig.h"


#ifdef STDC_HEADERS
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#endif

/*
   }}} 
 */
/*
   {{{ typedefs 
 */

#if SIZEOF_UNSIGNED_LONG_INT == 8
typedef unsigned long word64;
#define TIGER_64BIT
#elif SIZEOF_UNSIGNED_LONG_LONG_INT == 8

#ifndef _MSC_VER /* _WIN32 */
typedef unsigned long long word64;
#else //ifdef _MSC_VER /* _WIN32 */
typedef DWORD64 word64;
#endif
#else
#error "Cannot find a 64 bit integer in your system, sorry."
#endif

#if SIZEOF_UNSIGNED_LONG_INT == 4
typedef unsigned long word32;
#elif SIZEOF_UNSIGNED_INT == 4
typedef unsigned int word32;
#else
#error "Cannot find a 32 bit integer in your system, sorry."
#endif

#if SIZEOF_UNSIGNED_INT == 2
typedef unsigned int word16;
#elif SIZEOF_UNSIGNED_SHORT_INT == 2
typedef unsigned short word16;
#else
#error "Cannot find a 16 bit integer in your system, sorry."
#endif

#if SIZEOF_UNSIGNED_CHAR == 1
typedef unsigned char word8;
#else
#error "Cannot find an 8 bit char in your system, sorry."
#endif

typedef word8 byte;
typedef word32 dword;

/*
   }}} 
 */

/*
   {{{ macros and defines 
 */

#define RAND32 (word32) ((word32)rand() << 17 ^ (word32)rand() << 9 ^ rand())

#ifndef HAVE_MEMMOVE
#ifdef HAVE_BCOPY
#define memmove(d, s, n) bcopy ((s), (d), (n))
#else
#error "Neither memmove nor bcopy exists on your system."
#endif
#endif

#define ENCRYPT 0
#define DECRYPT 1

/*
   }}} 
 */

/*
   {{{ prototypes 
 */

void Bzero(void *s, int n);

word32 byteswap(word32 x);

int BreakToThree(void *key, unsigned int keylen,
				 void *keyword1, void *keyword2, void *keyword3);

/*
   }}} 
 */

#endif