Added trans.c for transaction funtions. Implemented transStart() and transCreateObj...
[IRC.git] / Robust / src / Runtime / DSTM / interface / mlookup.h
1 #ifndef _MLOOKUP_H_
2 #define _MLOOKUP_H_
3
4 #include <stdlib.h>
5 #include <stdio.h>
6
7 #define LOADFACTOR 0.75
8 #define HASH_SIZE 100
9
10 typedef struct mhashlistnode {
11         unsigned int key;
12         void *val; //this can be cast to another type or used to point to a larger structure
13         struct mhashlistnode *next;
14 } mhashlistnode_t;
15
16 typedef struct mhashtable {
17         mhashlistnode_t *table; // points to beginning of hash table
18         unsigned int size;
19         unsigned int numelements;
20         float loadfactor;
21 } mhashtable_t;
22
23 unsigned int mhashCreate(unsigned int size, float loadfactor);
24 unsigned int mhashFunction(unsigned int key);
25 unsigned mhashInsert(unsigned int key, void *val);
26 void *mhashSearch(unsigned int key); //returns val, NULL if not found
27 unsigned int mhashRemove(unsigned int key); //returns -1 if not found
28 unsigned int mhashResize(unsigned int newsize);
29
30 #endif
31