title: Why is modulo operator necessary?
body: <p>I've read in a document that you can replace mod operation by logical and like this :</p>
  
  <p>Instead:</p>
  
  <pre><code>int Limit = Value % Range;
  </code></pre>
  
  <p>You do:</p>
  
  <pre><code>int Limit = Value &amp; (Range-1);
  </code></pre>
  
  <p>But compilers still generate mod instructions and my question is basically : Why do compilers don't use the most efficient approach if they work the same ? </p>