title: Find which power of 2 range a number falls within? (In C)
body: <p>As in whether it falls within 2^3 - 2^4, 2^4 - 2^5, etc. The number returned would be the EXPONENT itself (minus an offset).</p>
  
  <p>How could this be done extremely quickly and efficiently as possible? This function will be called a lot in a program that is EXTREMELY dependent on speed. This is my current code but it is far too inefficient as it uses a for loop.</p>
  
  <pre><code>static inline size_t getIndex(size_t numOfBytes)
  {
      int i = 3;
      for (; i &lt; 32; i++) 
      {
          if (numOfBytes &lt; (1 &lt;&lt; i)) 
              return i - OFFSET;
      }
      return (NUM_OF_BUCKETS - 1);
  }
  </code></pre>
  
  <p>Thank you very much!</p>