1 #ifndef HASH_H
2 #define HASH_H
3 
4 //
5 // todo:
6 //
7 // - Try to reuse temps holding addresses/indirect loads within same function
8 //
9 
10 struct hash_element
11 {
12 	struct hash_element *next;
13 	def_t *def;
14 };
15 
16 #define HSIZE1 16384
17 
18 // JPG
19 #define OPTABLESIZE 128
20 
21 extern struct hash_element *htable[HSIZE1];
22 extern void inithash();
23 extern int optable[OPTABLESIZE]; // JPG
24 
25 
26 extern int stats[HSIZE1];
27 
hash(char * string)28 inline static unsigned int hash (char *string)
29 {
30 	unsigned int index = 0;
31 	int count;
32 
33 	for (count = 0; string[count] != '\0' && count < 15; count++)
34 		index = (index << 1) ^ string[count];
35 
36 	return index & (HSIZE1 - 1);
37 }
38 
39 #endif
40 
41 void HashImmediate (void);