title: How to Iterate only directly set enum values in plain c?
body: <p>
  I have an <code>enum</code> defined in plain c like so:</p>
  
  <pre class="lang-c prettyprint-override"><code>typedef enum {
      // Determine position of Red and Green color:
      // RED[2:0], GREEN[5:3], BLUE implicitly. Thus, [7:6]==!0
      LED_BO_RedGreenBlue=0b00010001,
      LED_BO_RedBlueGreen=0b00100001,
      LED_BO_GreenBlueRed=0b00001100,
      LED_BO_GreenRedBlue=0b00001010,
      LED_BO_BlueRedGreen=0b00100010,
      LED_BO_BlueGreenRed=0b00010100,
  } led_byteorder_values_t;
  </code></pre>
  
  <p>Unfortuantely, the only way I have come up with to check if a given <code>uint8_t</code> has a value defined explicitly in this enum is this:</p>
  
  <pre class="lang-c prettyprint-override"><code>uint8_t byteToTest = 0; // has invalid value, so /default/ path will be taken.
  switch (byteToTest) {
      case: LED_BO_RedGreenBlue: break;
      case: LED_BO_RedBlueGreen: break;
      case: LED_BO_GreenBlueRed: break;
      case: LED_BO_GreenRedBlue: break;
      case: LED_BO_BlueRedGreen: break;
      case: LED_BO_BlueGreenRed: break;
      default: byteToTest = LED_BO_RedGreenBlue; break;
  }
  </code></pre>
  
  <p>Is there a better / shorter way to test a variable against arbitrary values, possibly without having to define an additional <code>const [...]</code>?</p>