title: Define BIT0, BIT1, BIT2, etc Without #define
body: <p>Is it possible in C++ to define BIT0, BIT1, BIT2 in another way in C++ without using #define?</p>
  
  <pre><code>#define BIT0 0x00000001
  #define BIT1 0x00000002
  #define BIT2 0x00000004
  </code></pre>
  
  <p>I then take the same thing and make states out of those bits:</p>
  
  <pre><code>#define MOTOR_UP   BIT0
  #define MOTOR_DOWN BIT1
  </code></pre>
  
  <p>Note: I am using 32 bits only, not 64 bits. I am also using a <code>setBit(flagVariable, BIT)</code> (consequently a <code>clrBit</code> macro to do the opposite) macro to set the bits then compare whether the bit is set using the bitwise operator such as</p>
  
  <pre><code>if (flagVariable &amp; MOTOR_UP) { 
     // do something
     clrBit(flagVariable, MOTOR_UP);
  }
  </code></pre>
  
  <p>Is there a type in C++ that already contains these bit masks?</p>