Committer: Fabiano C. Botelho <fbotelho@fbotelho-desk.(none)>
On branch master Changes to be committed: Fixing bugs reported by Steve Friedman, Kaštil Jan and a bug that was accidently introduced in file chd_ph.c in 1.0 release. modified: src/bdz.c modified: src/bitbool.h modified: src/chd_ph.c modified: src/cmph_structs.c modified: src/hash.c
This commit is contained in:
parent
084a940c2a
commit
5315e3a597
15
src/bdz.c
15
src/bdz.c
@ -560,21 +560,6 @@ void bdz_load(FILE *f, cmph_t *mphf)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
static cmph_uint32 bdz_search_ph(cmph_t *mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
bdz_data_t *bdz = mphf->data;
|
||||
cmph_uint32 hl[3];
|
||||
hash_vector(bdz->hl, key, keylen, hl);
|
||||
cmph_uint32 vertex;
|
||||
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 vertex;
|
||||
}
|
||||
*/
|
||||
|
||||
static inline cmph_uint32 rank(cmph_uint32 b, cmph_uint32 * ranktable, cmph_uint8 * g, cmph_uint32 vertex)
|
||||
{
|
||||
register cmph_uint32 index = vertex >> b;
|
||||
|
@ -31,15 +31,6 @@ static const cmph_uint8 valuemask[] = { 0xfc, 0xf3, 0xcf, 0x3f};
|
||||
*/
|
||||
#define SETBIT(array, i) (array[i >> 3] |= bitmask[i & 0x00000007])
|
||||
|
||||
/** \def UNSETBIT(array, i)
|
||||
* \brief set 0 to an 1-bit integer stored in an array.
|
||||
* \param array to store 1-bit integer values
|
||||
* \param i is the index in array to set the the bit to 0
|
||||
*
|
||||
* UNSETBIT(array, i) is a macro that sets 0 to an 1-bit integer stored in an array.
|
||||
*/
|
||||
#define UNSETBIT(array, i) (array[i >> 3] ^= ((bitmask[i & 0x00000007])))
|
||||
|
||||
//#define GETBIT(array, i) (array[(i) / 8] & bitmask[(i) % 8])
|
||||
//#define SETBIT(array, i) (array[(i) / 8] |= bitmask[(i) % 8])
|
||||
//#define UNSETBIT(array, i) (array[(i) / 8] ^= ((bitmask[(i) % 8])))
|
||||
|
@ -625,7 +625,7 @@ cmph_t *chd_ph_new(cmph_config_t *mph, double c)
|
||||
chd_ph_data_t *chd_phf = NULL;
|
||||
chd_ph_config_data_t *chd_ph = (chd_ph_config_data_t *)mph->data;
|
||||
|
||||
register double load_factor = 0.6;
|
||||
register double load_factor = c;
|
||||
register cmph_uint8 searching_success = 0;
|
||||
register cmph_uint32 max_probes = 1 << 20; // default value for max_probes
|
||||
register cmph_uint32 iterations = 100;
|
||||
@ -641,7 +641,6 @@ cmph_t *chd_ph_new(cmph_config_t *mph, double c)
|
||||
double construction_time = 0.0;
|
||||
ELAPSED_TIME_IN_SECONDS(&construction_time_begin);
|
||||
#endif
|
||||
c = load_factor;
|
||||
|
||||
|
||||
chd_ph->m = mph->key_source->nkeys;
|
||||
|
@ -8,8 +8,8 @@
|
||||
cmph_config_t *__config_new(cmph_io_adapter_t *key_source)
|
||||
{
|
||||
cmph_config_t *mph = (cmph_config_t *)malloc(sizeof(cmph_config_t));
|
||||
memset(mph, 0, sizeof(cmph_config_t));
|
||||
if (mph == NULL) return NULL;
|
||||
memset(mph, 0, sizeof(cmph_config_t));
|
||||
mph->key_source = key_source;
|
||||
mph->verbosity = 0;
|
||||
mph->data = NULL;
|
||||
|
@ -59,7 +59,9 @@ void hash_state_dump(hash_state_t *state, char **buf, cmph_uint32 *buflen)
|
||||
{
|
||||
case CMPH_HASH_JENKINS:
|
||||
jenkins_state_dump((jenkins_state_t *)state, &algobuf, buflen);
|
||||
if (*buflen == UINT_MAX) return;
|
||||
if (*buflen == UINT_MAX) {
|
||||
goto cmph_cleanup;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
@ -70,6 +72,7 @@ void hash_state_dump(hash_state_t *state, char **buf, cmph_uint32 *buflen)
|
||||
len = *buflen;
|
||||
memcpy(*buf + strlen(cmph_hash_names[state->hashfunc]) + 1, algobuf, len);
|
||||
*buflen = (cmph_uint32)strlen(cmph_hash_names[state->hashfunc]) + 1 + *buflen;
|
||||
cmph_cleanup:
|
||||
free(algobuf);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user