If b
is a 64-element BitArray
, then b.chunks[1]
is the same data as an Int64
, but in bit-reversed order. There are various algorithms for efficiently bit-reversing back to regular order; I’m not sure which one is the fastest, but you can definitely do better than going bit-by-bit.
(But if this conversion is really performance-critical for you then a BitArray
may not be the best choice of data structure.)