git-svn-id: http://svn.openzap.org/svn/openzap/trunk@15 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale
2007-05-17 16:57:26 +00:00
parent 22433a9970
commit f57307bf91
10 changed files with 145 additions and 50 deletions

View File

@@ -5,6 +5,7 @@
#include "hashtable.h"
/*****************************************************************************/
struct entry
{
@@ -19,17 +20,20 @@ struct hashtable {
unsigned int entrycount;
unsigned int loadlimit;
unsigned int primeindex;
unsigned int (*hashfn) (const void *k);
int (*eqfn) (const void *k1, const void *k2);
unsigned int (*hashfn) (void *k);
int (*eqfn) (void *k1, void *k2);
};
/*****************************************************************************/
unsigned int
hash(struct hashtable *h, const void *k);
hash(struct hashtable *h, void *k);
/*****************************************************************************/
/* indexFor */
#define indexFor(hashvalue, tablelength) (unsigned int)(hashvalue % tablelength)
static __inline__ unsigned int
indexFor(unsigned int tablelength, unsigned int hashvalue) {
return (hashvalue % tablelength);
}
/* Only works if tablelength == 2^N */
/*static inline unsigned int