are you looking for:

help?> reinterpret
Base.reinterpret(type, A)

   Change the type-interpretation of a block of memory. For example,
   "reinterpret(Float32, uint32(7))" interprets the 4 bytes
   corresponding to "uint32(7)" as a "Float32". For arrays, this
   constructs an array with the same binary data as the given array,
   but with the specified element type.



On Sat, 2014-11-29 at 15:11, [email protected] wrote:
> Hello,
>
> I would like to convert a byte string like b"abe34" into a BitArray. I 
> could use this function, but it will be horribly slow :
>
> function bytesToBitarray(s::Array{Uint8,1}) 
>        t = BitArray(size(s, 1)*8)
>        for i in 1:size(s, 1)
>            for j in 0:7
>              t[8(i-1) + j + 1] = s[i] & (1<<j)
>            end
>        end
>        t
>  end
>
>  how can I do this efficiently ?
>
> Sébastien

Reply via email to