title: Efficient bit shuffling of vector of binary numbers
body: <p>I have recorded data containing a vector of bit-sequences, which I would like to re-arrange efficiently. One value in the vector of data could look like this:</p>
  
  <pre><code>bit0, bit1, bit2, ... bit7
  </code></pre>
  
  <p>I would like to re-arrange this bit-sequence into this order:</p>
  
  <pre><code>bit0, bit7, bit1, bit6, bit2, bit5, bit3, bit4
  </code></pre>
  
  <p>If I had only one value this would work nicely via:</p>
  
  <pre><code>sum(uint32(bitset(0,1:8,bitget(uint32(X), [1 8 2 7 3 6 4 5]))))
  </code></pre>
  
  <p>Unfortunately bitset and bitget are not capable of handling vectors of bit-sequences. Since I have a fairly large dataset I am interested in efficient solutions.</p>
  
  <p>Any help would be appreciated, thanks!</p>