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

Function average_run

ccan/ccan/htable/tools/density.c:39–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39static size_t average_run(const struct htable_ptrint *ht, size_t count, size_t *longest)
40{
41 size_t i, total = 0;
42
43 *longest = 0;
44 for (i = 0; i < count; i++) {
45 size_t h = hash_uintptr(i + 2);
46 size_t run = 1;
47
48 while (get_raw_ptr(&ht->raw, ht->raw.table[h % ((size_t)1 << ht->raw.bits)]) != int2ptr(i + 2)) {
49 h++;
50 run++;
51 }
52 total += run;
53 if (run > *longest)
54 *longest = run;
55 }
56 return total / count;
57}
58
59int main(int argc, char *argv[])
60{

Callers 1

mainFunction · 0.85

Calls 3

hash_uintptrFunction · 0.85
get_raw_ptrFunction · 0.85
int2ptrFunction · 0.85

Tested by

no test coverage detected