XMA: read a cursor's bits a byte's worth at a time #1258

Closed
github-bot wants to merge 1 commit from gh-pr/1258/head into gh-pr/1258/base
Owner

@⁠Jitheswar on GitHub · 2026-11-24 16:51 UTC · original
xma-frame-byte-copy → main · +56 −19 · 1 files · 1 commits · closed without merging

Rebased onto 940d32f. #1016 (merged) now gathers a frame's payload bytes directly inside a packet, which covers most of what this PR first did. What's left: Cursor::bits, still used for the length fields, the bytes that straddle a packet edge, and the tail, read one bit at a time. It now takes as many bits from each source byte as it can, still skipping the header and other streams' packets at each packet edge.

Test: a 29-bit frame whose first 1-16 bits end packet 0 (packet 1 is another stream's) reads back with its tail padding, and is refused one byte short. #1016's noise tests pass unchanged on top of this.

cargo test -p victory-formats 39 passed; cargo clippy -p victory-formats --all-targets -D warnings clean (Linux). No game data.

AI-assisted (Claude Code, Codex).

🤖 Generated with Claude Code

**@⁠Jitheswar** on GitHub · 2026-11-24 16:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/1258) `xma-frame-byte-copy` → `main` · +56 −19 · 1 files · 1 commits · closed without merging Rebased onto `940d32f`. #1016 (merged) now gathers a frame's payload bytes directly inside a packet, which covers most of what this PR first did. What's left: `Cursor::bits`, still used for the length fields, the bytes that straddle a packet edge, and the tail, read one bit at a time. It now takes as many bits from each source byte as it can, still skipping the header and other streams' packets at each packet edge. **Test:** a 29-bit frame whose first 1-16 bits end packet 0 (packet 1 is another stream's) reads back with its tail padding, and is refused one byte short. #1016's noise tests pass unchanged on top of this. `cargo test -p victory-formats` 39 passed; `cargo clippy -p victory-formats --all-targets -D warnings` clean (Linux). No game data. AI-assisted (Claude Code, Codex). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Read the available bits from each source byte and assemble whole output bytes while preserving packet skips and tail padding. Cover reads whose length or payload crosses an interleaved packet boundary.

Synthetic release benchmarks sped up frame gathering by 2.4x to 4.2x. The old and new readers agreed across 23,040 complete and truncated inputs. The formats suite, Linux and Windows-target Clippy, and asset policy passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:25:20 +00:00
github-bot closed this pull request 2026-11-26 04:25:21 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:35 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #1016. Same optimisation as #1016 (gather XMA frame bits in byte-sized chunks); also correct, but smaller gain and it removes Cursor::bit.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1258#issuecomment-7148677371) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1016. Same optimisation as #1016 (gather XMA frame bits in byte-sized chunks); also correct, but smaller gain and it removes Cursor::bit. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1258
No description provided.