.
Project description
BitMap for python
This package provides a BitMap
class which is an array of bits stored in compact format.
Installation
bitmap
can be installed from pip
:
$ sudo pip install bitmap
Functions
BitMap(maxnum)
: construct aBitMap
object withmaxnum
bitsset(pos)
: set the bit at positionpos
to 1reset(pos)
: reset the bit at positionpos
to 0flip(pos)
: flip the bit at positionpos
count()
: return the number of 1ssize()
: return the size of theBitMap
test(pos)
: check if bit at positionpos
has been set to 1any()
: check if any bit in theBitMap
has been set to 1none()
: check if none of the bits in theBitMap
has been set to 1all()
: check if all bits in theBitMap
has been set to 1nonzero()
: return indexes of all non-zero bitstostring()
: convert aBitMap
object to0
and1
stringfromstring(bitstring)
: create aBitMap
object from0
and1
string
Examples
from bitmap import BitMap
bm = BitMap(32)
print bm.tostring()
bm.set(1)
print bm.tostring()
bm = BitMap.fromstring("00011101")
print bm.tostring()
bm.flip(1)
print bm.tostring()
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
bitmap-0.0.7.tar.gz
(3.4 kB
view details)
Built Distributions
File details
Details for the file bitmap-0.0.7.tar.gz
.
File metadata
- Download URL: bitmap-0.0.7.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7fb8fcdade2223348132c108619f93178b563f584ed552aa5d3c6f946958a2d |
|
MD5 | 12d443f62dbb6a54d8aa48e32ddba62a |
|
BLAKE2b-256 | 5c4216842f4fdaabd710fbe7b2577a016f4ac9b5b3076e29611f96716c5a672b |
File details
Details for the file bitmap-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: bitmap-0.0.7-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e768adb29a7429729e79c0bd59d6351b47b65b6fc7478c239e07fefdc4dfc49 |
|
MD5 | 85aec86f94dfc2788f02b4400878587d |
|
BLAKE2b-256 | 3a180cf0116c3faf5023a6e971549055d42907020bca37320b3ada380e07f3ff |
File details
Details for the file bitmap-0.0.7-py2-none-any.whl
.
File metadata
- Download URL: bitmap-0.0.7-py2-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee994535356cf18f82793823a873ae4feb6074e3cd7b443176ca4e208d59f9f7 |
|
MD5 | 1193bba266786999dc01b17151ac500e |
|
BLAKE2b-256 | 0f0caaf4bce788435605e40d0f5f4f3c7077337254fbce6c308386a8f18f350f |