size_t i, placed_perfect = 0;
for (i = 0; i < ((size_t)1 << ht->bits); i++) {
- if (!entry_is_valid(ht->table[i]))
+ if (!entry_is_valid(ht, i))
continue;
if (hash_bucket(ht, ht->rehash(get_raw_ptr(ht, ht->table[i]),
ht->priv)) == i) {
- assert((ht->table[i] & ht->perfect_bit)
- == ht->perfect_bit);
+ assert((ht->table[i] & ht_perfect_mask(ht))
+ == ht_perfect_mask(ht));
placed_perfect++;
}
}
size_t i, delete_markers = 0;
for (i = 0; i < ((size_t)1 << ht->bits); i++) {
- if (ht->table[i] == HTABLE_DELETED)
+ if (entry_is_deleted(ht, i))
delete_markers++;
}
return delete_markers;
}
/* Nanoseconds per operation */
-static size_t normalize(const struct timespec *start,
- const struct timespec *stop,
+static size_t normalize(const struct timeabs *start,
+ const struct timeabs *stop,
unsigned int num)
{
- return time_to_nsec(time_divide(time_sub(*stop, *start), num));
+ return time_to_nsec(time_divide(time_between(*stop, *start), num));
}
static size_t worst_run(struct htable *ht, size_t *deleted)
int main(int argc, char *argv[])
{
struct object *objs;
- size_t i, j, num, deleted;
- struct timespec start, stop;
+ unsigned int i, j;
+ size_t num, deleted;
+ struct timeabs start, stop;
struct htable_obj ht;
bool make_dumb = false;
printf("Details: delete markers %zu, perfect %.0f%%\n",
count_deleted(&ht.raw), perfect(&ht.raw) * 100.0 / ht.raw.elems);
i = worst_run(&ht.raw, &deleted);
- printf("Details: worst run %zu (%zu deleted)\n", i, deleted);
+ printf("Details: worst run %u (%zu deleted)\n", i, deleted);
printf("Lookup after churn & spread (match): ");
fflush(stdout);