https://en.wikipedia.org/wiki/Binary_logarithm#Algorithm