1 //=============================
8 #define Hash_BytesForBuckets(b) (sizeof(bucket_t*)*(b))
10 #define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1+1,s2+1)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
11 typedef struct bucket_s {
17 struct bucket_s *next;
19 typedef struct hashtable_s {
20 unsigned int numbuckets;
24 void Hash_InitTable(hashtable_t *table, unsigned int numbucks, void *mem); //mem must be 0 filled. (memset(mem, 0, size))
25 unsigned int Hash_Key(const char *name, unsigned int modulus);
26 void *Hash_Get(hashtable_t *table, const char *name);
27 void *Hash_GetInsensative(hashtable_t *table, const char *name);
28 void *Hash_GetKey(hashtable_t *table, unsigned int key);
29 void *Hash_GetNext(hashtable_t *table, const char *name, void *old);
30 void *Hash_GetNextInsensative(hashtable_t *table, const char *name, void *old);
31 void *Hash_GetNextKey(hashtable_t *table, unsigned int key, void *old);
32 void *Hash_Add(hashtable_t *table, const char *name, void *data, bucket_t *buck);
33 void *Hash_AddInsensative(hashtable_t *table, const char *name, void *data, bucket_t *buck);
34 void Hash_Remove(hashtable_t *table, const char *name);
35 void Hash_RemoveData(hashtable_t *table, const char *name, void *data);
36 void Hash_RemoveKey(hashtable_t *table, unsigned int key);
37 void *Hash_AddKey(hashtable_t *table, unsigned int key, void *data, bucket_t *buck);