7 /* mgchash *********************************************************/
8 typedef struct mgchashlistnode {
10 void * val; //this can be cast to another type or used to point to a
12 struct mgchashlistnode *next;
15 #define NUMMGCLIST 250
16 typedef struct mgclist {
17 struct mgchashlistnode array[NUMMGCLIST];
22 typedef struct mgchashtable {
23 mgchashlistnode_t * table; // points to beginning of hash table
24 mgcliststruct_t * structs;
27 unsigned int numelements;
28 unsigned int threshold;
32 mgchashtable_t * mgchashCreate(unsigned int size, double loadfactor);
33 void mgchashInsert(mgchashtable_t * tbl, void * key, void *val);
34 void * mgchashSearch(mgchashtable_t * tbl, void * key);
35 unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize);
37 mgchashtable_t * mgchashCreate_I(unsigned int size, double loadfactor);
38 void mgchashInsert_I(mgchashtable_t * tbl, void * key, void *val);
39 unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize);
41 void mgchashDelete(mgchashtable_t * tbl);
42 void mgchashreset(mgchashtable_t * tbl);
45 /** MGCHash *******************************************************************/
46 struct MGCHash * allocateMGCHash(int size, int conflicts);
47 void freeMGCHash(struct MGCHash *);
49 int MGCHashadd(struct MGCHash *, int data);
51 struct MGCHash * allocateMGCHash_I(int size, int conflicts);
52 int MGCHashadd_I(struct MGCHash *, int data);
54 int MGCHashcontains(struct MGCHash *,int data);
59 struct MGCNode *bucket;
62 /* MGCHashException *************************************************/
65 struct MGCNode * next;