Repository navigation
Bitarray v0.1.0
·
24 commits
to main
since this release
Bitarray v0.1.0
Overview
First release of the native Mojo Bitarray implementation in PyroMojo.
Features
- Mutable packed-bit arrays.
- Big-endian and little-endian bit ordering.
- Construction, indexing, assignment, slicing, and iteration.
- Append, extend, insert, and delete.
- Concatenation and lexicographic comparisons.
- Bitwise AND, OR, XOR, and NOT.
- In-place bitwise operations.
- Length-preserving shifts.
- Count and search.
- Find and index.
- Reverse, copy, fill, and rotate.
- Byte serialization and deserialization.
- Framed binary CLI protocol.
Testing
- 74 native Mojo tests, all passing (storage, sequence, mutation, bitwise, count/search, extras, serialization).
- 391 Python compatibility tests against
bitarray==3.12.3, all passing. - 266 deterministic golden vectors with drift checking (
generate_vectors.py --check), all consistent with the reference. - Full repository suite: 545 pytest tests passed, all 22 native suites passed, ruff and format checks clean.
Compatibility Notes
Documented deviations from the Python reference implementation:
search()returns a materializedList[Int]of match positions instead of Python's lazysearchiterator; positions and order are identical.- Mojo uses its general
Errortype with reference message text rather than Python's exception hierarchy. - Direct self-aliasing (
a &= a,a[1:3] = a) requires an explicit snapshot (a &= a[:],a[1:3] = a[:]). - Mojo has no
del a[i]syntax; single-index deletion isdelete(i)with the reference__delitem__semantics. - The serialization format carries the logical bit length explicitly (
uint32_be nbits | uint8 endian_id | packed bytes); it is never inferred from packed bytes.
Deferred Features
Not included in v0.1.0: frozenbitarray, buffer protocol, file operations (tofile/fromfile), pack()/unpack(), sorting, bitarray.util, bitarray.bitfields, and prefix-code machinery. Approved but pending for a later release (within the frozen v0.1 scope): pop, remove, clear, setall, invert(i), all/any, repetition (*/*=), and multi-index deletion.