C++ 20: std::bit_width()
std::cout << std::bit_width(10u); // prints 4 as of 00001010bNote that it accepts only unsigned types.Deduct 1 to get the zero based position to answer your question.
C++ 20: std::bit_width()
std::cout << std::bit_width(10u); // prints 4 as of 00001010bNote that it accepts only unsigned types.Deduct 1 to get the zero based position to answer your question.