Covert BitArray to Int64

It might be even easier to just build your own array type that just uses the Int directly as its storage:

julia> mutable struct IntBitVec <: AbstractVector{Bool}
           data::UInt64
       end
       Base.size(::IntBitVec) = (64,)
       @inline function Base.getindex(v::IntBitVec, i::Int)
           @boundscheck checkbounds(v, i)
           v.data & (1 << (i-1)) != 0 # Just change i-1 to 65-i to reverse the bits
       end

julia> IntBitVec(1)
64-element IntBitVec:
  true
 false
 false
 false
     ⋮

julia> IntBitVec(2)
64-element IntBitVec:
 false
  true
 false
 false
     ⋮
1 Like