Skip to content

Add skipBits() for skipping bits in bit-field sequences - #331

Open
hippi345 wants to merge 1 commit into
keichi:masterfrom
hippi345:cursor/skip-bits-b6a6
Open

hippi345 wants to merge 1 commit into
keichi:masterfrom
hippi345:cursor/skip-bits-b6a6

Conversation

@hippi345

Copy link
Copy Markdown

Adds Parser.skipBits(length), which moves the bit cursor forward inside a bit-field sequence without adding anything to the parsed object. Today the workaround is to define bit1 through bit32 fields and then throw the values away.

  • length must be a positive integer, and options such as assert are rejected.
  • Bit-field code generation consumes the skipped bits without assigning them.
  • The README documents the new method.
  • New tests cover parsing, an invalid length, and rejected options.

npm run format, npm run build and npm test pass (192 tests).

Closes #91

Introduce Parser.skipBits(length) for advancing the bit cursor during
bit-field parsing without adding fields to the parsed result. Document
the API in README and add regression tests.
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.

Skipping bits

1 participant