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

Function worst_run

ccan/ccan/htable/tools/speed.c:104–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104static size_t worst_run(struct htable *ht, size_t *deleted)
105{
106 size_t longest = 0, len = 0, this_del = 0, i;
107
108 *deleted = 0;
109 /* This doesn't take into account end-wrap, but gives an idea. */
110 for (i = 0; i < ((size_t)1 << ht->bits); i++) {
111 if (ht->table[i]) {
112 len++;
113 if (ht->table[i] == HTABLE_DELETED)
114 this_del++;
115 } else {
116 if (len > longest) {
117 longest = len;
118 *deleted = this_del;
119 }
120 len = 0;
121 this_del = 0;
122 }
123 }
124 return longest;
125}
126
127int main(int argc, char *argv[])
128{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected