3 static size_t hash(const void *ptr, void *priv UNNEEDED)
5 /* We're hashing pointers; no need to get too fancy. */
6 return ((size_t)ptr / sizeof(ptr)) ^ ((size_t)ptr % sizeof(ptr));
9 /* 24042: Waiting on 0x5570a500c3f8 (11742786623615)
10 24042: Waiting on 0x5570a500c430 (11742786623622)
11 24042: Searching for 0x5570a500c3f8 (11742786623615) in 2 elems
12 24042: Searching for 0x5570a500c3f8 (11742786623615) in 2 elems
14 static struct htable waittable = HTABLE_INITIALIZER(waittable, hash, NULL);
18 const void *p1 = (void *)0x5570a500c3f8ULL;
19 const void *p2 = (void *)0x5570a500c430ULL;
25 printf("hash %p == %zu\n", p1, hash(p1, NULL));
26 printf("hash %p == %zu\n", p2, hash(p2, NULL));
27 htable_add(&waittable, hash(p1, NULL), p1);
28 htable_add(&waittable, hash(p2, NULL), p2);
32 for (p = htable_firstval(&waittable, &i, h);
34 p = htable_nextval(&waittable, &i, h)) {
42 for (p = htable_firstval(&waittable, &i, h);
44 p = htable_nextval(&waittable, &i, h)) {