Removed fingerprint methods and fixed pending bugs.
This commit is contained in:
27
src/bdz.c
27
src/bdz.c
@@ -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
|
||||
|
||||
14
src/bdz.h
14
src/bdz.h
@@ -17,20 +17,6 @@ int bdz_dump(cmph_t *mphf, FILE *f);
|
||||
void bdz_destroy(cmph_t *mphf);
|
||||
cmph_uint32 bdz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** 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);
|
||||
|
||||
/** \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
|
||||
|
||||
38
src/bdz_ph.c
38
src/bdz_ph.c
@@ -527,44 +527,6 @@ void bdz_ph_destroy(cmph_t *mphf)
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** cmph_uint32 bdz_ph_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_ph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
||||
{
|
||||
register bdz_ph_data_t *bdz_ph = mphf->data;
|
||||
cmph_uint32 hl[3];
|
||||
register cmph_uint8 byte0, byte1, byte2;
|
||||
register cmph_uint32 vertex;
|
||||
|
||||
hash_vector(bdz_ph->hl, key, keylen,hl);
|
||||
memcpy(fingerprint, hl, sizeof(hl));
|
||||
|
||||
hl[0] = hl[0] % bdz_ph->r;
|
||||
hl[1] = hl[1] % bdz_ph->r + bdz_ph->r;
|
||||
hl[2] = hl[2] % bdz_ph->r + (bdz_ph->r << 1);
|
||||
|
||||
byte0 = bdz_ph->g[hl[0]/5];
|
||||
byte1 = bdz_ph->g[hl[1]/5];
|
||||
byte2 = bdz_ph->g[hl[2]/5];
|
||||
|
||||
byte0 = lookup_table[hl[0]%5][byte0];
|
||||
byte1 = lookup_table[hl[1]%5][byte1];
|
||||
byte2 = lookup_table[hl[2]%5][byte2];
|
||||
vertex = hl[(byte0 + byte1 + byte2)%3];
|
||||
|
||||
return vertex;
|
||||
}
|
||||
|
||||
/** \fn void bdz_ph_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
|
||||
|
||||
14
src/bdz_ph.h
14
src/bdz_ph.h
@@ -16,20 +16,6 @@ int bdz_ph_dump(cmph_t *mphf, FILE *f);
|
||||
void bdz_ph_destroy(cmph_t *mphf);
|
||||
cmph_uint32 bdz_ph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** cmph_uint32 bdz_ph_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_ph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
||||
|
||||
/** \fn void bdz_ph_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
|
||||
|
||||
31
src/bmz.c
31
src/bmz.c
@@ -22,7 +22,7 @@ static void bmz_traverse_non_critical_nodes(bmz_config_data_t *bmz, cmph_uint8 *
|
||||
|
||||
bmz_config_data_t *bmz_config_new()
|
||||
{
|
||||
bmz_config_data_t *bmz;
|
||||
bmz_config_data_t *bmz = NULL;
|
||||
bmz = (bmz_config_data_t *)malloc(sizeof(bmz_config_data_t));
|
||||
assert(bmz);
|
||||
memset(bmz, 0, sizeof(bmz_config_data_t));
|
||||
@@ -539,35 +539,6 @@ void bmz_destroy(cmph_t *mphf)
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** cmph_uint32 bmz_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 bmz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
||||
{
|
||||
bmz_data_t *bmz = mphf->data;
|
||||
cmph_uint32 h1, h2;
|
||||
|
||||
hash_vector(bmz->hashes[0], key, keylen, fingerprint);
|
||||
h1 = fingerprint[2] % bmz->n;
|
||||
|
||||
hash_vector(bmz->hashes[1], key, keylen, fingerprint);
|
||||
h2 = fingerprint[2] % bmz->n;
|
||||
|
||||
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
|
||||
if (h1 == h2 && ++h2 > bmz->n) h2 = 0;
|
||||
DEBUGP("key: %s g[h1]: %u g[h2]: %u edges: %u\n", key, bmz->g[h1], bmz->g[h2], bmz->m);
|
||||
return bmz->g[h1] + bmz->g[h2];
|
||||
}
|
||||
|
||||
/** \fn void bmz_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
|
||||
|
||||
14
src/bmz.h
14
src/bmz.h
@@ -16,20 +16,6 @@ int bmz_dump(cmph_t *mphf, FILE *f);
|
||||
void bmz_destroy(cmph_t *mphf);
|
||||
cmph_uint32 bmz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** cmph_uint32 bmz_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 bmz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
||||
|
||||
/** \fn void bmz_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
|
||||
|
||||
29
src/bmz8.c
29
src/bmz8.c
@@ -548,35 +548,6 @@ void bmz8_destroy(cmph_t *mphf)
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** cmph_uint8 bmz8_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_uint8 bmz8_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
||||
{
|
||||
bmz8_data_t *bmz8 = mphf->data;
|
||||
cmph_uint8 h1, h2;
|
||||
|
||||
hash_vector(bmz8->hashes[0], key, keylen, fingerprint);
|
||||
h1 = fingerprint[2] % bmz8->n;
|
||||
|
||||
hash_vector(bmz8->hashes[1], key, keylen, fingerprint);
|
||||
h2 = fingerprint[2] % bmz8->n;
|
||||
|
||||
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
|
||||
if (h1 == h2 && ++h2 > bmz8->n) h2 = 0;
|
||||
DEBUGP("key: %s g[h1]: %u g[h2]: %u edges: %u\n", key, bmz8->g[h1], bmz8->g[h2], bmz8->m);
|
||||
return bmz8->g[h1] + bmz8->g[h2];
|
||||
}
|
||||
|
||||
/** \fn void bmz8_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
|
||||
|
||||
14
src/bmz8.h
14
src/bmz8.h
@@ -16,20 +16,6 @@ int bmz8_dump(cmph_t *mphf, FILE *f);
|
||||
void bmz8_destroy(cmph_t *mphf);
|
||||
cmph_uint8 bmz8_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** cmph_uint8 bmz8_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_uint8 bmz8_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
||||
|
||||
/** \fn void bmz8_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
|
||||
|
||||
28
src/brz.c
28
src/brz.c
@@ -712,32 +712,6 @@ void brz_destroy(cmph_t *mphf)
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** cmph_uint32 brz_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 brz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
||||
{
|
||||
brz_data_t *brz = mphf->data;
|
||||
switch(brz->algo)
|
||||
{
|
||||
case CMPH_FCH:
|
||||
return brz_fch_search(brz, key, keylen, fingerprint);
|
||||
case CMPH_BMZ8:
|
||||
return brz_bmz8_search(brz, key, keylen, fingerprint);
|
||||
default: assert(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \fn void brz_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
|
||||
@@ -791,7 +765,7 @@ void brz_pack(cmph_t *mphf, void *packed_mphf)
|
||||
#if defined (__ia64) || defined (__x86_64__)
|
||||
cmph_uint64 * g_is_ptr = (cmph_uint64 *)ptr;
|
||||
#else
|
||||
cmph_uint32 * g_is_ptr = ptr;
|
||||
cmph_uint32 * g_is_ptr = (cmph_uint32 *)ptr;
|
||||
#endif
|
||||
|
||||
cmph_uint8 * g_i = (cmph_uint8 *) (g_is_ptr + data->k);
|
||||
|
||||
14
src/brz.h
14
src/brz.h
@@ -21,20 +21,6 @@ int brz_dump(cmph_t *mphf, FILE *f);
|
||||
void brz_destroy(cmph_t *mphf);
|
||||
cmph_uint32 brz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** cmph_uint32 brz_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 brz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
||||
|
||||
/** \fn void brz_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
|
||||
|
||||
34
src/chm.c
34
src/chm.c
@@ -19,10 +19,10 @@ static void chm_traverse(chm_config_data_t *chm, cmph_uint8 *visited, cmph_uint3
|
||||
|
||||
chm_config_data_t *chm_config_new()
|
||||
{
|
||||
chm_config_data_t *chm;
|
||||
chm_config_data_t *chm = NULL;
|
||||
chm = (chm_config_data_t *)malloc(sizeof(chm_config_data_t));
|
||||
assert(chm);
|
||||
memset(chm,0,sizeof(chm_config_data_t));
|
||||
memset(chm, 0, sizeof(chm_config_data_t));
|
||||
chm->hashfuncs[0] = CMPH_HASH_JENKINS;
|
||||
chm->hashfuncs[1] = CMPH_HASH_JENKINS;
|
||||
chm->g = NULL;
|
||||
@@ -293,36 +293,6 @@ void chm_destroy(cmph_t *mphf)
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
|
||||
/** cmph_uint32 chm_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 chm_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
||||
{
|
||||
chm_data_t *chm = mphf->data;
|
||||
cmph_uint32 h1, h2;
|
||||
|
||||
hash_vector(chm->hashes[0], key, keylen, fingerprint);
|
||||
h1 = fingerprint[2] % chm->n;
|
||||
|
||||
hash_vector(chm->hashes[1], key, keylen, fingerprint);
|
||||
h2 = fingerprint[2] % chm->n;
|
||||
|
||||
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
|
||||
if (h1 == h2 && ++h2 >= chm->n) h2 = 0;
|
||||
DEBUGP("key: %s g[h1]: %u g[h2]: %u edges: %u\n", key, chm->g[h1], chm->g[h2], chm->m);
|
||||
return (chm->g[h1] + chm->g[h2]) % chm->m;
|
||||
}
|
||||
|
||||
/** \fn void chm_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
|
||||
|
||||
14
src/chm.h
14
src/chm.h
@@ -16,20 +16,6 @@ int chm_dump(cmph_t *mphf, FILE *f);
|
||||
void chm_destroy(cmph_t *mphf);
|
||||
cmph_uint32 chm_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** cmph_uint32 chm_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 chm_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
||||
|
||||
/** \fn void chm_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
|
||||
|
||||
48
src/cmph.c
48
src/cmph.c
@@ -612,54 +612,6 @@ cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** cmph_uint32 cmph_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 cmph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
||||
{
|
||||
DEBUGP("mphf algorithm: %u \n", mphf->algo);
|
||||
switch(mphf->algo)
|
||||
{
|
||||
case CMPH_CHM:
|
||||
return chm_search_fingerprint(mphf, key, keylen, fingerprint);
|
||||
case CMPH_BMZ: /* included -- Fabiano */
|
||||
DEBUGP("bmz algorithm search\n");
|
||||
return bmz_search_fingerprint(mphf, key, keylen, fingerprint);
|
||||
case CMPH_BMZ8: /* included -- Fabiano */
|
||||
DEBUGP("bmz8 algorithm search\n");
|
||||
return bmz8_search_fingerprint(mphf, key, keylen, fingerprint);
|
||||
case CMPH_BRZ: /* included -- Fabiano */
|
||||
DEBUGP("brz algorithm search\n");
|
||||
return brz_search_fingerprint(mphf, key, keylen, fingerprint);
|
||||
case CMPH_FCH: /* included -- Fabiano */
|
||||
DEBUGP("fch algorithm search\n");
|
||||
return fch_search_fingerprint(mphf, key, keylen, fingerprint);
|
||||
case CMPH_BDZ: /* included -- Fabiano */
|
||||
DEBUGP("bdz algorithm search\n");
|
||||
return bdz_search_fingerprint(mphf, key, keylen, fingerprint);
|
||||
case CMPH_BDZ_PH: /* included -- Fabiano */
|
||||
DEBUGP("bdz_ph algorithm search\n");
|
||||
return bdz_ph_search_fingerprint(mphf, key, keylen, fingerprint);
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
cmph_uint32 cmph_size(cmph_t *mphf)
|
||||
{
|
||||
return mphf->size;
|
||||
|
||||
16
src/cmph.h
16
src/cmph.h
@@ -69,22 +69,6 @@ cmph_t *cmph_new(cmph_config_t *mph);
|
||||
*/
|
||||
cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** cmph_uint32 cmph_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.,
|
||||
* \brief 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 cmph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
||||
|
||||
|
||||
cmph_uint32 cmph_size(cmph_t *mphf);
|
||||
void cmph_destroy(cmph_t *mphf);
|
||||
|
||||
|
||||
27
src/fch.c
27
src/fch.c
@@ -411,33 +411,6 @@ void fch_destroy(cmph_t *mphf)
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** cmph_uint32 fch_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 fch_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
||||
{
|
||||
register fch_data_t *fch = mphf->data;
|
||||
|
||||
hash_vector(fch->h1, key, keylen, fingerprint);
|
||||
register cmph_uint32 h1 = fingerprint[2] % fch->m;
|
||||
|
||||
hash_vector(fch->h2, key, keylen, fingerprint);
|
||||
register cmph_uint32 h2 = fingerprint[2] % fch->m;
|
||||
|
||||
h1 = mixh10h11h12 (fch->b, fch->p1, fch->p2, h1);
|
||||
//DEBUGP("key: %s h1: %u h2: %u g[h1]: %u\n", key, h1, h2, fch->g[h1]);
|
||||
return (h2 + fch->g[h1]) % fch->m;
|
||||
}
|
||||
|
||||
/** \fn void fch_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
|
||||
|
||||
14
src/fch.h
14
src/fch.h
@@ -22,20 +22,6 @@ int fch_dump(cmph_t *mphf, FILE *f);
|
||||
void fch_destroy(cmph_t *mphf);
|
||||
cmph_uint32 fch_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** cmph_uint32 fch_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 fch_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
||||
|
||||
/** \fn void fch_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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef WIN32
|
||||
#include "../wingetopt.h"
|
||||
#include "wingetopt.h"
|
||||
#else
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user