glasgow icon indicating copy to clipboard operation
glasgow copied to clipboard

Add bitarray implementation to eliminate external dependency

Open mndza opened this issue 5 years ago • 0 comments

This PR is an attempt to address #179. This bitarray implementation follows the interface established by glasgow.support.bits while changing the backing storage to an array() object. Currently the element size of this array is a byte and not a machine word.

I am not particularly happy with the byte_reverse / byte_reversed method names to imply in-place modification or not. Also, I am not sure about the correct behavior in those functions when the number of stored bits is not a multiple of the byte size. Right now it drops the bits that exceed the bit length after the byte reversal.

Please note that for initializing the bitarray from a bytes object you need to provide the explicit length in bits. This is because I copied the constructor interface from glasgow.support.bits, but I do not know if that is the desired operation.

Most of the test cases were copied from glasgow.support.bits.

mndza avatar Jan 24 '21 15:01 mndza