17 #define INLINE inline __attribute__((always_inline))
22 /* mgchash *********************************************************/
23 typedef struct mgchashlistnode {
25 void * val; //this can be cast to another type or used to point to a
27 struct mgchashlistnode *next;
28 //struct mgchashlistnode *lnext;
31 #define NUMMGCLIST 250
32 typedef struct mgclist {
33 struct mgchashlistnode array[NUMMGCLIST];
38 typedef struct mgchashtable {
39 mgchashlistnode_t * table; // points to beginning of hash table
40 //mgchashlistnode_t * list;
41 mgcliststruct_t * structs;
44 unsigned int numelements;
45 unsigned int threshold;
49 mgchashtable_t * mgchashCreate(unsigned int size, double loadfactor);
50 void mgchashInsert(mgchashtable_t * tbl, void * key, void *val);
51 void * mgchashSearch(mgchashtable_t * tbl, void * key);
52 unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize);
54 mgchashtable_t * mgchashCreate_I(unsigned int size, double loadfactor);
55 void mgchashInsert_I(mgchashtable_t * tbl, void * key, void *val);
56 unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize);
58 void mgchashDelete(mgchashtable_t * tbl);
59 void mgchashreset(mgchashtable_t * tbl);
62 /** MGCHash *******************************************************************/
63 struct MGCHash * allocateMGCHash(int size, int conflicts);
64 void freeMGCHash(struct MGCHash *);
66 //void MGCHashrehash(struct MGCHash * thisvar);
67 int MGCHashadd(struct MGCHash *, int data);
69 struct MGCHash * allocateMGCHash_I(int size, int conflicts);
70 int MGCHashadd_I(struct MGCHash *, int data);
72 int MGCHashcontains(struct MGCHash *,int data);
77 struct MGCNode *bucket;
80 /* MGCHashException *************************************************/
83 struct MGCNode * next;