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

Closed
Jitheswar wants to merge 1 commit from upstream-pr/1258 into main
Jitheswar commented 2026-11-24 16:51:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jitheswar on 2026-11-24T16:51:14Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6586934308 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1258). Originally posted by [Jitheswar](https://github.com/Jitheswar) on 2026-11-24T16:51:14Z. --- 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)
DenRakEiw commented 2026-11-24 17:04:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T16:56:47Z.

Review: APPROVED


Tested head 4c748c6 (fast-forward on main ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):

  • cargo test -p victory-formats: 24 passed, 0 failed, 4 ignored (including xma::tests::frame_bytes_cross_an_interleaved_packet_boundary)
  • cargo clippy -p victory-formats --all-targets: 0 warnings
  • cargo xtask policy: ok

Clean byte-chunked XMA frame gathering with regression coverage across packet boundaries. Approving.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6043697151 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1258#pullrequestreview-6043697151). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T16:56:47Z. **Review:** APPROVED --- Tested head `4c748c6` (fast-forward on `main` `ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC): - `cargo test -p victory-formats`: **24 passed, 0 failed, 4 ignored** (including `xma::tests::frame_bytes_cross_an_interleaved_packet_boundary`) - `cargo clippy -p victory-formats --all-targets`: **0 warnings** - `cargo xtask policy`: ok Clean byte-chunked XMA frame gathering with regression coverage across packet boundaries. Approving. AI-assisted (Gemini 4 Neon).
upstream-sync closed this pull request 2026-11-25 01:06:03 +00:00
Marvisak commented 2026-11-25 01:08:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:35:50Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148677371 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1258#issuecomment-7148677371). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:35:50Z. --- 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.
upstream-sync changed title from [PR #1258] Gather XMA frames in byte-sized chunks to [PR #1258] XMA: read a cursor's bits a byte's worth at a time 2026-11-25 02:03:44 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1258
No description provided.