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 mgcliststruct_t * structs;
42 unsigned int numelements;
43 unsigned int threshold;
47 mgchashtable_t * mgchashCreate(unsigned int size, double loadfactor);
48 void mgchashInsert(mgchashtable_t * tbl, void * key, void *val);
49 void * mgchashSearch(mgchashtable_t * tbl, void * key);
50 unsigned int mgchashResize(mgchashtable_t * tbl, unsigned int newsize);
52 mgchashtable_t * mgchashCreate_I(unsigned int size, double loadfactor);
53 void mgchashInsert_I(mgchashtable_t * tbl, void * key, void *val);
54 unsigned int mgchashResize_I(mgchashtable_t * tbl, unsigned int newsize);
56 void mgchashDelete(mgchashtable_t * tbl);
57 void mgchashreset(mgchashtable_t * tbl);
60 /** MGCHash *******************************************************************/
61 struct MGCHash * allocateMGCHash(int size, int conflicts);
62 void freeMGCHash(struct MGCHash *);
64 int MGCHashadd(struct MGCHash *, int data);
66 struct MGCHash * allocateMGCHash_I(int size, int conflicts);
67 int MGCHashadd_I(struct MGCHash *, int data);
69 int MGCHashcontains(struct MGCHash *,int data);
74 struct MGCNode *bucket;
77 /* MGCHashException *************************************************/
80 struct MGCNode * next;