]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/test/run-type.c
htable: avoid branch in calculating perfect bit.
[ccan] / ccan / htable / test / run-type.c
index 38a323cc3922ab445fed18c236f4ffd1f0f987d1..f097acb69fdec375acb8472fdc0034a452cd05ca 100644 (file)
@@ -83,7 +83,7 @@ static void del_vals(struct htable_obj *ht,
 }
 
 static void del_vals_bykey(struct htable_obj *ht,
-                          const struct obj val[], unsigned int num)
+                          const struct obj val[] UNNEEDED, unsigned int num)
 {
        unsigned int i;
 
@@ -122,7 +122,7 @@ int main(void)
        dne = i;
 
        htable_obj_init(&ht);
-       ok1(ht.raw.max == 0);
+       ok1(ht_max(&ht.raw) == 0);
        ok1(ht.raw.bits == 0);
 
        /* We cannot find an entry which doesn't exist. */
@@ -131,7 +131,7 @@ int main(void)
        /* Fill it, it should increase in size. */
        add_vals(&ht, val, NUM_VALS);
        ok1(ht.raw.bits == NUM_BITS + 1);
-       ok1(ht.raw.max < (1 << ht.raw.bits));
+       ok1(ht_max(&ht.raw) < (1 << ht.raw.bits));
 
        /* Mask should be set. */
        ok1(ht.raw.common_mask != 0);