Multiply by De Bruijn sequence and lookup index
Computing the base‑2 logarithm of an integer (more precisely: finding the index of the highest set bit) is a common operation in systems programming, graphics, data compression, and low‑level algorithms. While Rust provides methods like u32::leading_zeros(), sometimes you may want your own implementation—especially an approach that is branch‑free, fast, and works on all stable targets.
