https://github.com/jmaister/bitarray
Python implementation of a bitarray
https://github.com/jmaister/bitarray
bitarray python
Last synced: 3 months ago
JSON representation
Python implementation of a bitarray
- Host: GitHub
- URL: https://github.com/jmaister/bitarray
- Owner: jmaister
- Created: 2014-01-09T23:41:57.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2020-12-06T18:54:00.000Z (about 5 years ago)
- Last Synced: 2025-01-31T21:17:35.889Z (12 months ago)
- Topics: bitarray, python
- Language: Python
- Size: 5.86 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
bitarray
========
Full Python implementation of a bitarray.
Memory optimization: It packs 32 or 64 bits on a float. Depending on the platform.
Blog entry with explanation on: [jordiburgos.com/post/2014/python-bitarray-sieve-eratosthenes.html](http://jordiburgos.com/post/2014/python-bitarray-sieve-eratosthenes.html)
Usage:
MAX = 2^^32
ba = BitArray(MAX, initialize=1)
for n in xrange(2, MAX, 2):
ba.reset_bit(n)
ba.set_bit(120)
if ba.get_bit(120):
pass
Sample usage on pysieve.py