title: Bitmask to Array Index
body: <p>Is there a simple way to convert a bitmask in to an array index?</p>
  
  <p>ie. If i've got an enum</p>
  
  <pre><code>a = 0x01,
  b = 0x02,
  c = 0x04,
  d = 0x08,
  e = 0x10, 
  etc
  </code></pre>
  
  <p>and I want to store releated data in an array, is there a simple way such that i can convert a to 0, b to 1, c to 2. etc?</p>
  
  <p>Many thanks</p>