]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/test/run-type-int.c
htable: reduce size of htable by storing perfect bitnum, not mask.
[ccan] / ccan / htable / test / run-type-int.c
index 061ae76f07f356bc1a619e5335d48cd4f995dac7..16c4f56ed40a98d2384ee97d23472f11ec7eed9a 100644 (file)
@@ -88,7 +88,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;
 
@@ -127,7 +127,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. */
@@ -136,7 +136,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);