Most efficient way of converting binary data to `AbstractVector{Bool}`

You’re right — BitArray doesn’t have any public or officially supported ways of doing this. If you have a Vector{Uint64}, then you can “sneak” the data in behind its back:

julia> A = rand(UInt64, 20)
       B = BitArray(0)
       B.chunks = A
       B.len = length(A)*64
       B
1280-element BitArray{1}:
 false
  true
  true
 false
     ⋮

As always, beware that this may change/break at any point.

1 Like