keep on left shifting the number till it becomes 0. the moment it becomes 0, the count of how many times you had to right shift the number to get 0 is the answer.
On Thu, Jun 14, 2012 at 11:45 AM, Krishna Kishore <[email protected]>wrote: > How to find the LEFT MOST set bit in an unsigned integer. > Example: > "00*1*0 0001 0100 0010" is a 16-bit unsigned integer. We have to find the > left most set bit position (Starting with 0 from right side ) > which is 13th position in our example. How to find this. Can any one pls > give any suggestions. > Thank You Very Much In Advance. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/HJnuFujMZ3wJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards Anika Jain -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
