*** empty log message ***
This commit is contained in:
parent
e3a161b899
commit
1ce421d289
10
src/brz.c
10
src/brz.c
@ -741,7 +741,7 @@ void brz_pack(cmph_t *mphf, void *packed_mphf)
|
|||||||
ptr += sizeof(data->k);
|
ptr += sizeof(data->k);
|
||||||
|
|
||||||
// packing c
|
// packing c
|
||||||
*((cmph_uint32 *)ptr) = (cmph_uint32)data->c;
|
*((cmph_uint64 *)ptr) = (cmph_uint64)data->c;
|
||||||
ptr += sizeof(data->c);
|
ptr += sizeof(data->c);
|
||||||
|
|
||||||
// packing h1 type
|
// packing h1 type
|
||||||
@ -856,8 +856,8 @@ static cmph_uint32 brz_bmz8_search_packed(cmph_uint32 *packed_mphf, const char *
|
|||||||
|
|
||||||
register cmph_uint32 k = *packed_mphf++;
|
register cmph_uint32 k = *packed_mphf++;
|
||||||
|
|
||||||
register double c = (double)(*packed_mphf);
|
register double c = (double)(*((cmph_uint64*)packed_mphf));
|
||||||
packed_mphf++;
|
packed_mphf += 2;
|
||||||
|
|
||||||
register CMPH_HASH h1_type = *packed_mphf++;
|
register CMPH_HASH h1_type = *packed_mphf++;
|
||||||
|
|
||||||
@ -911,8 +911,8 @@ static cmph_uint32 brz_fch_search_packed(cmph_uint32 *packed_mphf, const char *k
|
|||||||
|
|
||||||
register cmph_uint32 k = *packed_mphf++;
|
register cmph_uint32 k = *packed_mphf++;
|
||||||
|
|
||||||
register double c = (double)(*packed_mphf);
|
register double c = (double)(*((cmph_uint64*)packed_mphf));
|
||||||
packed_mphf++;
|
packed_mphf += 2;
|
||||||
|
|
||||||
register CMPH_HASH h1_type = *packed_mphf++;
|
register CMPH_HASH h1_type = *packed_mphf++;
|
||||||
|
|
||||||
|
20
src/fch.c
20
src/fch.c
@ -28,7 +28,7 @@ fch_config_data_t *fch_config_new()
|
|||||||
fch->hashfuncs[0] = CMPH_HASH_JENKINS;
|
fch->hashfuncs[0] = CMPH_HASH_JENKINS;
|
||||||
fch->hashfuncs[1] = CMPH_HASH_JENKINS;
|
fch->hashfuncs[1] = CMPH_HASH_JENKINS;
|
||||||
fch->m = fch->b = 0;
|
fch->m = fch->b = 0;
|
||||||
fch->c = fch->p1 = fch->p2 = 0;
|
fch->c = fch->p1 = fch->p2 = 0.0;
|
||||||
fch->g = NULL;
|
fch->g = NULL;
|
||||||
fch->h1 = NULL;
|
fch->h1 = NULL;
|
||||||
fch->h2 = NULL;
|
fch->h2 = NULL;
|
||||||
@ -57,10 +57,11 @@ void fch_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs)
|
|||||||
|
|
||||||
cmph_uint32 mixh10h11h12(cmph_uint32 b, double p1, double p2, cmph_uint32 initial_index)
|
cmph_uint32 mixh10h11h12(cmph_uint32 b, double p1, double p2, cmph_uint32 initial_index)
|
||||||
{
|
{
|
||||||
if (initial_index < p1) initial_index %= (cmph_uint32)p2; /* h11 o h10 */
|
register cmph_uint32 int_p2 = (cmph_uint32)p2;
|
||||||
|
if (initial_index < p1) initial_index %= int_p2; /* h11 o h10 */
|
||||||
else { /* h12 o h10 */
|
else { /* h12 o h10 */
|
||||||
initial_index %= b;
|
initial_index %= b;
|
||||||
if(initial_index < p2) initial_index += (cmph_uint32)p2;
|
if(initial_index < p2) initial_index += int_p2;
|
||||||
}
|
}
|
||||||
return initial_index;
|
return initial_index;
|
||||||
}
|
}
|
||||||
@ -448,11 +449,11 @@ void fch_pack(cmph_t *mphf, void *packed_mphf)
|
|||||||
ptr += sizeof(data->b);
|
ptr += sizeof(data->b);
|
||||||
|
|
||||||
// packing p1
|
// packing p1
|
||||||
*((cmph_uint32 *)ptr) = (cmph_uint32)data->p1;
|
*((cmph_uint64 *)ptr) = (cmph_uint64)data->p1;
|
||||||
ptr += sizeof(data->p1);
|
ptr += sizeof(data->p1);
|
||||||
|
|
||||||
// packing p2
|
// packing p2
|
||||||
*((cmph_uint32 *)ptr) = (cmph_uint32)data->p2;
|
*((cmph_uint64 *)ptr) = (cmph_uint64)data->p2;
|
||||||
ptr += sizeof(data->p2);
|
ptr += sizeof(data->p2);
|
||||||
|
|
||||||
// packing g
|
// packing g
|
||||||
@ -498,17 +499,16 @@ cmph_uint32 fch_search_packed(void *packed_mphf, const char *key, cmph_uint32 ke
|
|||||||
|
|
||||||
register cmph_uint32 b = *g_ptr++;
|
register cmph_uint32 b = *g_ptr++;
|
||||||
|
|
||||||
register double p1 = (double)(*g_ptr);
|
register double p1 = (double)(*((cmph_uint64 *)g_ptr));
|
||||||
g_ptr++;
|
g_ptr += 2;
|
||||||
|
|
||||||
register double p2 = (double)(*g_ptr);
|
register double p2 = (double)(*((cmph_uint64 *)g_ptr));
|
||||||
g_ptr++;
|
g_ptr += 2;
|
||||||
|
|
||||||
register cmph_uint32 h1 = hash_packed(h1_ptr, h1_type, key, keylen) % m;
|
register cmph_uint32 h1 = hash_packed(h1_ptr, h1_type, key, keylen) % m;
|
||||||
register cmph_uint32 h2 = hash_packed(h2_ptr, h2_type, key, keylen) % m;
|
register cmph_uint32 h2 = hash_packed(h2_ptr, h2_type, key, keylen) % m;
|
||||||
|
|
||||||
h1 = mixh10h11h12 (b, p1, p2, h1);
|
h1 = mixh10h11h12 (b, p1, p2, h1);
|
||||||
return (h2 + g_ptr[h1]) % m;
|
return (h2 + g_ptr[h1]) % m;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user