title: Transform / rotate bits in byte array
body: <p>I'm looking for a way to quickly rotate the bits in a byte array without massive for loops that gets and sets each bit from old to new position.  In this particular circumstance I need to rotate by 90 degrees clockwise.
  So for instance if I have:</p>
  
  <pre><code>unsigned char array[8] = {
  0b11110000,
  0b10000000,
  0b10000000,
  0b10000000,
  0b00000000,
  0b00000000,
  0b00000000,
  0b00000001
  };
  </code></pre>
  
  <p>I need to get:</p>
  
  <pre><code>unsigned char array[8] = {
  0b00001111,
  0b00000001,
  0b00000001,
  0b00000001,
  0b00000000,
  0b00000000,
  0b00000000,
  0b10000000
  };
  </code></pre>
  
  <p>Looking for the most efficient way possible to do this ... but it may not always be an 8x8 grid of bits.  Will always be power of 2 dimension though (if that helps!)</p>