I have a bit array named c0
containing 28 bits
bitarray('1111011111111111111111110001')
how can I left shift this bit array for a number of times, meaning one left shift, two left shift, etc.? One left shift is fine for now!
NOTE: This pertains to the bitarray package.
You could use slicing:
These maintain the bit-width of the input, dropping bits on one end and padding with
0
on the other.You can create your own subclass of the
bitarray
type:Demo:
You can also poke the author to support these operations natively.