I wanted to see if there is a method for finding the binary log of a number. Say you have the number 4 then the power to which you raise two to get four is 2.
I know this is possible with shifting and counting but that uses O(N) operations. Is there some way to get O(1) for any n where x = 2^n?
I want to find n here knowing x in one operation or O(1).