Add hash table methodn for (pre)calculating base hash of a key

This commit is contained in:
Panu Matilainen 2012-09-05 10:37:28 +03:00
parent f974c457e3
commit b323c27d88
2 changed files with 13 additions and 0 deletions

View File

@ -102,6 +102,11 @@ static void HASHPREFIX(Resize)(HASHTYPE ht, int numBuckets) {
ht->numBuckets = numBuckets;
}
unsigned int HASHPREFIX(KeyHash)(HASHTYPE ht, HTKEYTYPE key)
{
return ht->fn(key);
}
void HASHPREFIX(AddEntry)(HASHTYPE ht, HTKEYTYPE key
#ifdef HTDATATYPE
, HTDATATYPE data

View File

@ -62,6 +62,14 @@ HASHTYPE HASHPREFIX(Free)( HASHTYPE ht);
RPM_GNUC_INTERNAL
void HASHPREFIX(Empty)(HASHTYPE ht);
/**
* Calculate hash for key.
* @param @ht pointer to hash table
* @param @key key
*/
RPM_GNUC_INTERNAL
unsigned int HASHPREFIX(KeyHash)(HASHTYPE ht, HTKEYTYPE key);
/**
* Add item to hash table.
* @param ht pointer to hash table