MCPcopy Create free account
hub / github.com/ElementsProject/lightning / perfect

Function perfect

ccan/ccan/htable/tools/speed.c:68–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68static size_t perfect(const struct htable *ht)
69{
70 size_t i, placed_perfect = 0;
71
72 for (i = 0; i < ((size_t)1 << ht->bits); i++) {
73 if (!entry_is_valid(ht->table[i]))
74 continue;
75 if (hash_bucket(ht, ht->rehash(get_raw_ptr(ht, ht->table[i]),
76 ht->priv)) == i) {
77 assert((ht->table[i] & ht_perfect_mask(ht))
78 == ht_perfect_mask(ht));
79 placed_perfect++;
80 }
81 }
82 return placed_perfect;
83}
84
85static size_t count_deleted(const struct htable *ht)
86{

Callers 1

mainFunction · 0.85

Calls 4

entry_is_validFunction · 0.85
hash_bucketFunction · 0.85
get_raw_ptrFunction · 0.85
ht_perfect_maskFunction · 0.85

Tested by

no test coverage detected