size_t hash1, hash2, bucket, cell;
assert(ckh != NULL);
- dassert(ckh->magic == CKH_MAGIC);
ckh->hash(key, ckh->lg_curbuckets, &hash1, &hash2);
* Cycle through the cells in the bucket, starting at a random position.
* The randomness avoids worst-case search overhead as buckets fill up.
*/
- prn32(offset, LG_CKH_BUCKET_CELLS, ckh->prn_state, CKH_A, CKH_C);
+ prng32(offset, LG_CKH_BUCKET_CELLS, ckh->prng_state, CKH_A, CKH_C);
for (i = 0; i < (ZU(1) << LG_CKH_BUCKET_CELLS); i++) {
cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) +
((i + offset) & ((ZU(1) << LG_CKH_BUCKET_CELLS) - 1))];
* were an item for which both hashes indicated the same
* bucket.
*/
- prn32(i, LG_CKH_BUCKET_CELLS, ckh->prn_state, CKH_A, CKH_C);
+ prng32(i, LG_CKH_BUCKET_CELLS, ckh->prng_state, CKH_A, CKH_C);
cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) + i];
assert(cell->key != NULL);
size_t usize;
lg_curcells++;
- usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE, NULL);
+ usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE);
if (usize == 0) {
ret = true;
- goto RETURN;
+ goto label_return;
}
tab = (ckhc_t *)ipalloc(usize, CACHELINE, true);
if (tab == NULL) {
ret = true;
- goto RETURN;
+ goto label_return;
}
/* Swap in new table. */
ttab = ckh->tab;
}
ret = false;
-RETURN:
+label_return:
return (ret);
}
*/
lg_prevbuckets = ckh->lg_curbuckets;
lg_curcells = ckh->lg_curbuckets + LG_CKH_BUCKET_CELLS - 1;
- usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE, NULL);
+ usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE);
if (usize == 0)
return;
tab = (ckhc_t *)ipalloc(usize, CACHELINE, true);
ckh->ninserts = 0;
ckh->nrelocs = 0;
#endif
- ckh->prn_state = 42; /* Value doesn't really matter. */
+ ckh->prng_state = 42; /* Value doesn't really matter. */
ckh->count = 0;
/*
ckh->hash = hash;
ckh->keycomp = keycomp;
- usize = sa2u(sizeof(ckhc_t) << lg_mincells, CACHELINE, NULL);
+ usize = sa2u(sizeof(ckhc_t) << lg_mincells, CACHELINE);
if (usize == 0) {
ret = true;
- goto RETURN;
+ goto label_return;
}
ckh->tab = (ckhc_t *)ipalloc(usize, CACHELINE, true);
if (ckh->tab == NULL) {
ret = true;
- goto RETURN;
+ goto label_return;
}
-#ifdef JEMALLOC_DEBUG
- ckh->magic = CKH_MAGIC;
-#endif
-
ret = false;
-RETURN:
+label_return:
return (ret);
}
{
assert(ckh != NULL);
- dassert(ckh->magic == CKH_MAGIC);
#ifdef CKH_VERBOSE
malloc_printf(
{
assert(ckh != NULL);
- dassert(ckh->magic == CKH_MAGIC);
return (ckh->count);
}
bool ret;
assert(ckh != NULL);
- dassert(ckh->magic == CKH_MAGIC);
assert(ckh_search(ckh, key, NULL, NULL));
#ifdef CKH_COUNT
while (ckh_try_insert(ckh, &key, &data)) {
if (ckh_grow(ckh)) {
ret = true;
- goto RETURN;
+ goto label_return;
}
}
ret = false;
-RETURN:
+label_return:
return (ret);
}
size_t cell;
assert(ckh != NULL);
- dassert(ckh->magic == CKH_MAGIC);
cell = ckh_isearch(ckh, searchkey);
if (cell != SIZE_T_MAX) {
size_t cell;
assert(ckh != NULL);
- dassert(ckh->magic == CKH_MAGIC);
cell = ckh_isearch(ckh, searchkey);
if (cell != SIZE_T_MAX) {
assert(hash1 != NULL);
assert(hash2 != NULL);
- h = hash(key, strlen((const char *)key), 0x94122f335b332aeaLLU);
+ h = hash(key, strlen((const char *)key), UINT64_C(0x94122f335b332aea));
if (minbits <= 32) {
/*
* Avoid doing multiple hashes, since a single hash provides
} else {
ret1 = h;
ret2 = hash(key, strlen((const char *)key),
- 0x8432a476666bbc13U);
+ UINT64_C(0x8432a476666bbc13));
}
*hash1 = ret1;
u.i = 0;
#endif
u.v = key;
- h = hash(&u.i, sizeof(u.i), 0xd983396e68886082LLU);
+ h = hash(&u.i, sizeof(u.i), UINT64_C(0xd983396e68886082));
if (minbits <= 32) {
/*
* Avoid doing multiple hashes, since a single hash provides
} else {
assert(SIZEOF_PTR == 8);
ret1 = h;
- ret2 = hash(&u.i, sizeof(u.i), 0x5e2be9aff8709a5dLLU);
+ ret2 = hash(&u.i, sizeof(u.i), UINT64_C(0x5e2be9aff8709a5d));
}
*hash1 = ret1;