title: Storing 8 logical true/false values inside 1 byte?
body: <p>I'm working on a microcontroller with only 2KB of SRAM and desperately need to conserve some memory. Trying to work out how I can put 8 <code>0</code>/<code>1</code> values into a single byte using a bitfield but can't quite work it out.</p>
  
  <pre><code>struct Bits
  {
      int8_t b0:1, b1:1, b2:1, b3:1, b4:1, b5:1, b6:1, b7:1;
  };
  
  int main(){
      Bits b;
      b.b0 = 0;
      b.b1 = 1;
  
      cout &lt;&lt; (int)b.b0; // outputs 0, correct
      cout &lt;&lt; (int)b.b1; // outputs -1, should be outputting 1
  }
  </code></pre>
  
  <p>What gives?</p>