title: Fast bidirectional bitshift?
body: <p>I have a piece of code that gets executed a lot, which I would like to optimize. It looks like this:</p>
  
  <pre><code>int exponent;
  uint32_t mantissa;
  
  if (exponent &lt; 0) {
      return mantissa &lt;&lt; -exponent;
  } else {
      return mantissa &gt;&gt; exponent;
  }
  </code></pre>
  
  <p>It's purpose is quite clear, it should right-shift <code>mantissa</code> by <code>exponent</code> places, where <code>exponent</code> can be negative.</p>
  
  <p>Is there a faster way to code this (without the branch if possible)?</p>