1 #include <ccan/tdb2/tdb.c>
2 #include <ccan/tdb2/free.c>
3 #include <ccan/tdb2/lock.c>
4 #include <ccan/tdb2/io.c>
5 #include <ccan/tdb2/hash.c>
6 #include <ccan/tdb2/check.c>
7 #include <ccan/tap/tap.h>
9 static unsigned int dumb_fls(uint64_t num)
13 for (i = 63; i >= 0; i--) {
14 if (num & (1ULL << i))
20 int main(int argc, char *argv[])
24 plan_tests(64 * 64 + 2);
27 ok1(dumb_fls(0) == 0);
29 for (i = 0; i < 64; i++) {
30 for (j = 0; j < 64; j++) {
31 uint64_t val = (1ULL << i) | (1ULL << j);
32 ok(fls64(val) == dumb_fls(val),
33 "%llu -> %u should be %u", (long long)val,
34 fls64(val), dumb_fls(val));