Welcome to little lamb

Code » test-msb » master » tree

[master] / src / m9.c

#include <stdint.h>

typedef uint64_t u64;

int msb(u64 v)
{
    long n = -1;

    __asm__("bsrq %1,%0"
        : "+r" (n)
        : "rm" (v));
    return n + 1;
}