title: Easy way to calculate integer powers of 2 in C#?
body: <p>I'm sure this isn't as difficult as I'm making it out to be.</p>
  
  <p>Would like to use something equivalent to <code>Math.Pow(double, double)</code> but outputting an integer.  I'm concerned about roundoff errors with the floating points.</p>
  
  <p>The best I can come up with is:</p>
  
  <pre><code>uint myPower = 12;
  uint myPowerOfTwo = (uint)Math.Pow(2.0, (double)myPower);
  </code></pre>
  
  <p>I thought of this:</p>
  
  <pre><code>uint myPowerOfTwo = 1 &lt;&lt; myPower;    // doesn't work
  </code></pre>
  
  <p>but I get the error that operator "&lt;&lt;" cannot be used with operands of type int <strike>or</strike> and uint.</p>
  
  <p>Any suggestions?  Thanks as always.</p>