Skip to content

Add skipbits and index to decodeiterator#252

Open
markmentovai wants to merge 1 commit into
ilanschnell:masterfrom
markmentovai:decodeiterator_skipbits
Open

Add skipbits and index to decodeiterator#252
markmentovai wants to merge 1 commit into
ilanschnell:masterfrom
markmentovai:decodeiterator_skipbits

Conversation

@markmentovai
Copy link
Copy Markdown

skipbits makes it possible to skip a portion of a bitarray that does not participate in the prefix coding.

index can be used to determine the position of an iterator within its associated bitarray.

Motivation: I’m decoding a bit stream that’s prefix-encoded, but with each symbol aligned to a 2-bit boundary. I introduced decodeiterator.index to determine the current position within the bit stream, and decodeiterator.skipbits to advance the iterator to the start of the next symbol. skipbits also returns the skipped-over bits so that I can validate that all bits used for alignment are 0.

I exposed the decodeiterator class to provide a clean way to document the new method and data descriptor. Strictly speaking, decodeiterator doesn’t need to be exposed in this way, but that left me wondering how to best provide its documentation.

Documentation and tests are present, and tests pass.

@markmentovai markmentovai force-pushed the decodeiterator_skipbits branch from be55d9e to 3a64aa4 Compare May 15, 2026 14:42
skipbits makes it possible to skip a portion of a bitarray that does not
participate in the prefix coding.

index can be used to determine the position of an iterator within its
associated bitarray.
@markmentovai markmentovai force-pushed the decodeiterator_skipbits branch from 3a64aa4 to 1c06960 Compare May 16, 2026 03:45
@markmentovai
Copy link
Copy Markdown
Author

Updated. #include “structmember.h” was missing, and this is necessary to make PyMemberDef (used for decodeiterator.index) available in Python < 3.12.

I’ve tested this with 3.8 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant