title: Unsigned modulos: alternative approach?
body: <p>I'm in a need to optimize this really tiny, but pesky function.</p>
  
  <pre><code>unsigned umod(int a, unsigned b)
  {
      while(a &lt; 0)
          a += b;
  
      return a % b;
  }
  </code></pre>
  
  <p>Before you cry out "You don't need to optimize it", please keep in mind that this function is called 50% of the entire program lifetime, as it's being called 21495808 times for the smallest test case benchmark. </p>
  
  <p>The function is already being inlined by the compiler so please don't offer to add the <code>inline</code> keyword.</p>