title: Set 4 bits of a specific byte
body: <p>Let's say I have the following bytes:</p>
  
  <pre><code>char* frame = new char[6];
  </code></pre>
  
  <p>That would result in this:</p>
  
  <pre><code>00000000 00000000 00000000 00000000 00000000 00000000
  </code></pre>
  
  <p>Now I take the first byte, <code>frame[0]</code> and set its last 4 bits like this:</p>
  
  <pre><code>frame[0] |= 1 &lt;&lt; 7
  frame[0] |= 1 &lt;&lt; 6
  frame[0] |= 1 &lt;&lt; 5
  frame[0] |= 1 &lt;&lt; 4
  </code></pre>
  
  <p>The first byte now:</p>
  
  <pre><code>11110000
  </code></pre>
  
  <p>I'm writing a function which is given a number between <code>0x0</code> and <code>0xF</code>. The number should be written into the first 4 bits of the byte. </p>
  
  <p>Example:</p>
  
  <pre><code>void setByte(char value)
  {
      // ... ??
  }
  
  setByte(0xD) // 0xD = 00001101;
  </code></pre>
  
  <p>After the function has finished the byte shall now look like this:</p>
  
  <pre><code>11111101
  </code></pre>
  
  <p>I'm not sure how I can do this - maybe it is possible to "copy" the last 4 bits into the other byte? </p>