-
Notifications
You must be signed in to change notification settings - Fork 865
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In gen_mtp3field_code_internal() it is not immediately clear what the OPC value processing code does and whether it does it correctly. I have verified that it combines byte swapping and bit shifting and indeed processes the value consistently with the specification. To make it easier to follow in future, replace the custom code and the custom bitmask with a combination of SWAPLONG() and a bitwise shift. The resulting bytecode remains intact (thus no OPC tests change). The DPC value processing code is plain byte swapping with no bitwise shift. The comparison uses BPF_W, but DPC spans only two adjacent bytes, so change it to BPF_H and use SWAPSHORT(), similar to the above. The resulting bytecode has the same effect (no DPC apply tests change), but the SNR becomes better, which is the only change in the corresponding DPC accept tests, e.g.: -(000) ld [4] -(001) and #0xff3f0000 -(002) jeq #0xd6310000 jt 3 jf 4 +(000) ldh [4] +(001) and #0xff3f +(002) jeq #0xd631 jt 3 jf 4 The SLS value processing code already uses BPF_B, so just reformat it along the same lines. The resulting bytecode remains intact (thus no SLS tests change). All of the above applies the same to the HSL variants ("hdpc", "hopc" and "hsls"), which differ by the field offsets only. Add comments to explain the updated code and replace several hard-coded values with named constants.
- Loading branch information
1 parent
62979bf
commit 2aebf46
Showing
2 changed files
with
121 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters