title: Algorithm for finding the smallest power of two that's greater or equal to a given value
body: <p>I need to find the smallest power of two that's greater or equal to a given value. So far, I have this:</p>
  
  <pre><code>int value = 3221; // 3221 is just an example, could be any number
  int result = 1;
  
  while (result &lt; value) result &lt;&lt;= 1;
  </code></pre>
  
  <p>It works fine, but feels kind of naive. Is there a better algorithm for that problem?</p>
  
  <p>EDIT. There were some nice Assembler suggestions, so I'm adding those tags to the question.</p>