2 ms·
Easy to count leading zeroes in a branch-free manner without a hardware instruction using a conditional move and a de Bruijn sequence; see https://github.com/ll
by pklausler 2y ago
Easy to count leading zeroes in a branch-free manner without a hardware instruction using a conditional move and a de Bruijn sequence; see https://github.com/llvm/llvm-project/blob/main/flang/include/flang/Common/leading-zero-bit-count.h https://github.com/llvm/llvm-project/blob/main/flang/include... .
- hinkley 2y agox |= x >> 1; x |= x >> 2; x |= x >> 4; x |= x >> 8; x |= x >> 16; x |= x >> 32; Isn't there another way to do this without so many data races? I feel like this should be x |= x >> 1 | x >> ??? ...