title: interpret unsigned as signed
body: <p>I'm working on an embedded platform (ARM) and have to be careful when dealing with bit patterns. Let's pretend this line is beyond my influence:</p>
  
  <pre><code>uint8_t foo = 0xCE;          // 0b11001110
  </code></pre>
  
  <p>Interpreted as unsigned this would be 206. But actually it's signed, thus resembling <strong>-50</strong>. How can I continue using this value as signed?</p>
  
  <pre><code>int8_t bar = foo;            // doesn't work
  </code></pre>
  
  <p>neither do (resulting in 0x10 or 0x00 for all input values)</p>
  
  <pre><code>int8_t bar = static_cast&lt;int8_t&gt;(foo);
  int8_t bar = reinterpret_cast&lt;int8_t&amp;&gt;(foo);
  </code></pre>
  
  <p>I just want the bits to remain untouched, ie. <code>(bar == 0xCE)</code></p>
  
  <p>Vice versa I'd be interested how to get bit-patters, representing negative numbers, into unsigned variables without messing the bit-pattern. I'm using GCC.</p>