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

Function unset_another_common_bit

ccan/ccan/htable/htable.c:208–223  ·  view source on GitHub ↗

Another bit currently in mask needs to be exposed, so that a bucket with p in * it won't appear invalid */

Source from the content-addressed store, hash-verified

206/* Another bit currently in mask needs to be exposed, so that a bucket with p in
207 * it won't appear invalid */
208static COLD void unset_another_common_bit(struct htable *ht,
209 uintptr_t *maskdiff,
210 const void *p)
211{
212 size_t i;
213
214 for (i = sizeof(uintptr_t) * CHAR_BIT - 1; i > 0; i--) {
215 if (((uintptr_t)p & ((uintptr_t)1 << i))
216 && ht->common_mask & ~*maskdiff & ((uintptr_t)1 << i))
217 break;
218 }
219 /* There must have been one, right? */
220 assert(i > 0);
221
222 *maskdiff |= ((uintptr_t)1 << i);
223}
224
225/* We want to change the common mask: this fixes up the table */
226static COLD void fixup_table_common(struct htable *ht, uintptr_t maskdiff)

Callers 2

fixup_table_commonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected