Welcome to little lamb

Code » test-msb » next » tree

[next] / src / test.c

#include <stdint.h>

typedef uint64_t u64;

extern int msb(u64 v);

int total = 0;

int main(void)
{
    for(int i = 4200000; i > 0; --i) {
        for(int l = 0; l < 64; ++l) {
            u64 n = 1ULL << l;
            total += msb(n - 1) + msb(n) + msb(n + 1);
        }
    }

    return 0;
}