s4-torture: add AES support for netr_ServerPasswordSet2 tests.
[Samba/bb.git] / lib / ntdb / test / run-001-fls.c
blobec61294c6f32b21db970503fb3d0356a1afa1b91
1 #include "ntdb-source.h"
2 #include "tap-interface.h"
4 static unsigned int dumb_fls(uint64_t num)
6 int i;
8 for (i = 63; i >= 0; i--) {
9 if (num & (1ULL << i))
10 break;
12 return i + 1;
15 int main(int argc, char *argv[])
17 unsigned int i, j;
19 plan_tests(64 * 64 + 2);
21 ok1(fls64(0) == 0);
22 ok1(dumb_fls(0) == 0);
24 for (i = 0; i < 64; i++) {
25 for (j = 0; j < 64; j++) {
26 uint64_t val = (1ULL << i) | (1ULL << j);
27 ok(fls64(val) == dumb_fls(val),
28 "%llu -> %u should be %u", (long long)val,
29 fls64(val), dumb_fls(val));
32 return exit_status();