Removed fingerprint methods and fixed pending bugs.

This commit is contained in:
davi
2008-04-28 01:18:23 +00:00
parent e0c009a62c
commit 2ad31e6bb9
23 changed files with 75 additions and 806 deletions

View File

@@ -599,33 +599,6 @@ void bdz_destroy(cmph_t *mphf)
free(mphf);
}
/** cmph_uint32 bdz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
* \param mphf pointer to the resulting function
* \param key is the key to be hashed
* \param keylen is the key legth in bytes
* \return The mphf value
*
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
* as fingerprint. According to the application, just few bits can be enough, once mphf does
* not allow collisions for the keys previously known.
*/
cmph_uint32 bdz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
{
register cmph_uint32 vertex;
register bdz_data_t *bdz = mphf->data;
cmph_uint32 hl[3];
hash_vector(bdz->hl, key, keylen, hl);
memcpy(fingerprint, hl, sizeof(hl));
hl[0] = hl[0] % bdz->r;
hl[1] = hl[1] % bdz->r + bdz->r;
hl[2] = hl[2] % bdz->r + (bdz->r << 1);
vertex = hl[(GETVALUE(bdz->g, hl[0]) + GETVALUE(bdz->g, hl[1]) + GETVALUE(bdz->g, hl[2])) % 3];
return rank(bdz->b, bdz->ranktable, bdz->g, vertex);
}
/** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
* \param mphf pointer to the resulting mphf