Learn how to compute a binary logarithm, it will help.