title: Handling unrolled loop remainder
body: <p>Good day.</p>
  
  <p>I'd like to ask for contribution on tricks to handle unrolled loops leftovers, with a caveat that loops are fairly small, 1-3 times the unrolling factor, eg:</p>
  
  <p>EG.  given unrolling factor of B</p>
  
  <pre><code>int i = 0;
  for (; i &lt; N-N%B; i += B) {
      ...
  }
  // remainder
  for (; i &lt; N; ++i) {
      ...
  }
  </code></pre>
  
  <p>if B is 2, I can do the following:</p>
  
  <pre><code>// remainder
  if (N%2) {
      ....
  }
  </code></pre>
  
  <p>But what is a good way to handle <code>B&gt;2</code> </p>