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

Function hash

ccan/ccan/htable/test/run-debug.c:16–28  ·  view source on GitHub ↗

We use the number divided by two as the hash (for lots of collisions), plus set all the higher bits so we can detect if they don't get masked out. */

Source from the content-addressed store, hash-verified

14 collisions), plus set all the higher bits so we can detect if they
15 don't get masked out. */
16static size_t hash(const void *elem, void *unused UNNEEDED)
17{
18 size_t h;
19
20 /* With CCAN_HTABLE_DEBUG enabled, it will try to hash each element,
21 * including this one... */
22 if (elem == bad_pointer)
23 return 0;
24
25 h = *(uint64_t *)elem / 2;
26 h |= -1UL << NUM_BITS;
27 return h;
28}
29
30static bool objcmp(const void *htelem, void *cmpdata)
31{

Callers 5

add_valsFunction · 0.70
refill_valsFunction · 0.70
find_valsFunction · 0.70
del_valsFunction · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected