fix(chans): assemble integer immediates without signed-shift overflow #1056
Reference in New Issue
Block a user
Delete Branch "agent/bittle/chans-immediate-review"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source-width correction
VmLoadImmInteger assembled big-endian immediate bytes by repeatedly left-shifting an s64. An eight-byte immediate whose first byte has its high bit set reaches signed-shift overflow. Accumulate in u64 and convert only the completed bit pattern to vmInteger at CHANSVmSetInteger.
Original PPC implements modulo-64 shift/OR, preserving all byte bits and passing the high/low result words in r5/r6. Short immediates remain non-sign-extending. The out-of-range unsigned-to-signed final conversion is implementation-defined in C; the configured MWCC behavior is verified. No universal portability claim, no fuzzy gain.
Independent verification
Rebased on 404a8675f1285007154a5aef7bbd755a691e8739; tested tree
1b490a2b4f.Focused helper/slice tests, not full VM or Wii runtime execution. Detailed evidence: tools/decomp-assist/CHANSVm-immediate-width-20261003.md. No linking flags, headers or unrelated decoder changes.
Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.