title: how to find left most 1 in a 32bit int in C
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/53161/find-the-highest-order-bit-in-c">Find the highest order bit in C</a>  </p>
  </blockquote>
  
  
  
  <p>How can I write a C function that will generate a mask indicating the leftmost <code>1</code> in <code>x</code>. </p>
  
  <p>Ex: <code>0xFF00 -&gt; 0x8000</code>, and <code>0x6600 -&gt; 0x4000</code>. So far:</p>
  
  <pre><code>int left1(unsigned x){}
  </code></pre>
  
  <p>I understand, <code>0xFF00 == 1111 1111 0000 0000..</code>
  and <code>0x6600 == 0110 0110 0000 0000..</code> but I'm stumped after that.</p>