title: What's the function of log2 in bit-manipulation?
body: <p>Why do we use log2 to get the position of the rightmost set bit?
  I can't understand. The entire code is here. Thanks a lot!</p>
  
  <pre><code>unsigned int getFirstSetBitPos(int n) 
  { 
      return log2(n &amp; -n) + 1; 
  } 
  </code></pre>