Find most significant bit without bitshifts
use std::uint8_t, to avoid relying on something that may or may not exist in the global namespace.
An unsigned type will always be &gt;= 0. So if a_variable is 0, this will result in undefined behaviour by accessing something out of bounds of the bitset (and either crash or loop forever).
If we're finding the "most significant bit", I don't think avoiding bitshifts makes it more readable. (This requires understanding of both numeric_limits::digits, and std::bitset instead).