www.pudn.com > ccache.rar > hash.h
/********************************************************************
created: 2008/01/23
filename: hash.h
author: Lichuang
purpose:
*********************************************************************/
#ifndef __HASH_H__
#define __HASH_H__
#include "ccache.h"
typedef struct hashitem_t
{
union
{
int first;
int root;
};
int nodenum;
pthread_mutex_t mutex;
}hashitem_t;
unsigned int hash(const void* key, ccache_t* cache);
int inithashitem(ccache_t* cache);
#define HASH_ITEM(cache, hashindex) (hashitem_t*)((char*)&((cache)->data[0]) + hashindex * sizeof(struct hashitem_t))
#endif /* __HASH_H__ */