Skip to main content

Utils for the Python bitarray module

Project description

python-bautils

bautils is a Python module implementing some useful helper functions for working with the Python bitarray module. Specifically, bautils supports adding (and, coming soon) other basic arithmetic operations on bitarrays as if they were arbitrary length binary numbers, something the bitarray package itself doesn’t seem to support.

I opted to put these functions in a new module; none are terribly complicated to implement, so they’re essentially just a set of convenient wrappers.

Currently bautils just contains the following routines. More work is planned for the future:

add(b1, b2): add two bitarrays together, returns the result.

left(ba, n): shifts a bitarray left by n, preserving the original size.

right(ba, n): shifts a bitarray right by n, preserving the original size.

random(length): returns a random bitarray of size length.

maxb(b1, b2): returns the larger bitarray.

minb(b1, b2): returns the smaller bitarray.

Unit tests are also a work in progress.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bautils-0.0.4.tar.gz (4.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page