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;
30 #define NUMMGCLIST 250
31 typedef struct mgclist {
32 struct mgchashlistnode array[NUMMGCLIST];
37 typedef struct mgchashtable {
38 mgchashlistnode_t * table; // points to beginning of hash table
39 mgchashlistnode_t * list;
40 mgcliststruct_t * structs;
43 unsigned int numelements;
44 unsigned int threshold;
48 mgchashtable_t * mgchashCreate(unsigned int size, double loadfactor);
49 void mgchashInsert(mgchashtable_t * tbl, void * key, void *val);
50 void * mgchashSearch(mgchashtable_t * tbl, void * key);
51 unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize);
53 mgchashtable_t * mgchashCreate_I(unsigned int size, double loadfactor);
54 void mgchashInsert_I(mgchashtable_t * tbl, void * key, void *val);
55 unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize);
57 void mgchashDelete(mgchashtable_t * tbl);
58 void mgchashreset(mgchashtable_t * tbl);
61 /** MGCHash *******************************************************************/
62 struct MGCHash * allocateMGCHash(int size, int conflicts);
63 void freeMGCHash(struct MGCHash *);
65 //void MGCHashrehash(struct MGCHash * thisvar);
66 int MGCHashadd(struct MGCHash *, int data);
68 struct MGCHash * allocateMGCHash_I(int size, int conflicts);
69 int MGCHashadd_I(struct MGCHash *, int data);
71 int MGCHashcontains(struct MGCHash *,int data);
76 struct MGCNode *bucket;
79 /* MGCHashException *************************************************/
82 struct MGCNode * next;