title: C: Most efficient way to set all bits in a range within a variable
body: <p>Let's take <code>int</code> as an example:</p>
  
  <pre><code>int SetBitWithinRange(const unsigned from, const unsigned to)
  {
      //To be implemented 
  } 
  </code></pre>
  
  <p><code>SetBitWithinRange</code> is supposed to return an <code>int</code>in which all and only the bits starting at bit <code>from</code> to bit <code>to</code> are set, when from is <code>smaller</code> than <code>to</code> and both are in the range of <code>0</code> to <code>32</code>. </p>
  
  <p>e.g.:
  <code>int i = SetBitWithinRange(2,4)</code> will result in <code>i</code> having the value of 0b00...01100</p>