fix(ezitext): align Chinese table-address return contract #1092

Merged
coah80 merged 1 commits from agent/bittle/chinese-table-return into main 2026-10-03 11:18:24 +00:00
coah80 commented 2026-10-03 11:17:12 +00:00 (Migrated from github.com)

Source-contract correction, no percentage gain

The Chinese caller unit declares Zi8GetTableAddress as returning ziPtr, incompatible with the existing exact definition's ziU32 return. Match that declaration and add 14 explicit consumer-typed conversions: twelve ziU8* and two ziU16*. Existing casts and all operations, argument values, conditions, scopes, ordering, callee definitions and configuration remain unchanged.

This follows the existing definition; original machine code proves full-width return flow, not a uniquely recoverable original integer-versus-pointer type spelling.

Independent parent validation

Fresh parent worktree/full default build on 3dd12f63de. Tested tree: be85da5869.

  • Entire changed unit object, all 1,027 source objects and complete report byte-identical to main
  • All five exact functions, all owned data/relocations, fuzzy and link measures unchanged
  • Unit: 5/8 exact functions, 4168/47816 exact code, 144/536 data, 96.65468% fuzzy
  • Independent raw-DOL audit: all 28 calls (20 Chinese engine, eight exact phonetic helper) consume full r3; wrapper forwards Zi8GetTableData return unchanged
  • Target-compiler static assertions verify 4-byte ziU32/pointer, 2-byte ziU16 and 1-byte ziU8
  • Pool identical; all eight functions audited for literals with zero errors/skips
  • Full default/progress/43U/ok, main/leaf checks and diff check pass
  • DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d

The older gM17 byte-pointer return trial failed on a legitimate halfword consumer; this correction preserves both halfword consumer types. No runtime behavior improvement or missing operation is claimed. Object identity is the emitted-code neutrality evidence, not a full dictionary-runtime test.

Evidence: tools/decomp-assist/chinese-table-address-contract-20261003.md. No original binaries/disassembly uploaded. Draft for human review; no merge or auto-merge requested.

Note

Fix Zi8GetTableAddress return-type contract in eZiText Chinese engine

  • Aligns the extern declaration of Zi8GetTableAddress in zi8cgetc.c to return a 32-bit unsigned integer, matching its definition's contract.
  • Adds explicit pointer conversions at each table-address consumer in zi8InternalGetZH and Zi8NewMatchPhonetic (phonetic, ordinal, character-range, frequency, filtered-search, pinyin, group, and candidate tables).
  • Matching logic, control flow, and indexing are unchanged; object identity and DOL hashes were verified per chinese-table-address-contract-20261003.md.
  • Risk: none — pure type-contract alignment with no runtime behavior change.

Macroscope summarized 6d43f6a.

## Source-contract correction, no percentage gain The Chinese caller unit declares Zi8GetTableAddress as returning ziPtr, incompatible with the existing exact definition's ziU32 return. Match that declaration and add 14 explicit consumer-typed conversions: twelve ziU8* and two ziU16*. Existing casts and all operations, argument values, conditions, scopes, ordering, callee definitions and configuration remain unchanged. This follows the existing definition; original machine code proves full-width return flow, not a uniquely recoverable original integer-versus-pointer type spelling. ## Independent parent validation Fresh parent worktree/full default build on 3dd12f63dec6f4d10a4347b4c87c4ee1317a1dc7. Tested tree: be85da58692c7e1c8e80f3023f73114e9fe3922e. - Entire changed unit object, all 1,027 source objects and complete report byte-identical to main - All five exact functions, all owned data/relocations, fuzzy and link measures unchanged - Unit: 5/8 exact functions, 4168/47816 exact code, 144/536 data, 96.65468% fuzzy - Independent raw-DOL audit: all 28 calls (20 Chinese engine, eight exact phonetic helper) consume full r3; wrapper forwards Zi8GetTableData return unchanged - Target-compiler static assertions verify 4-byte ziU32/pointer, 2-byte ziU16 and 1-byte ziU8 - Pool identical; all eight functions audited for literals with zero errors/skips - Full default/progress/43U/ok, main/leaf checks and diff check pass - DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d The older gM17 byte-pointer return trial failed on a legitimate halfword consumer; this correction preserves both halfword consumer types. No runtime behavior improvement or missing operation is claimed. Object identity is the emitted-code neutrality evidence, not a full dictionary-runtime test. Evidence: tools/decomp-assist/chinese-table-address-contract-20261003.md. No original binaries/disassembly uploaded. Draft for human review; no merge or auto-merge requested. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Fix `Zi8GetTableAddress` return-type contract in eZiText Chinese engine > - Aligns the extern declaration of `Zi8GetTableAddress` in [zi8cgetc.c](https://github.com/coah80/wii-ipl/pull/1092/files#diff-c5899d9823fec11392add0326b5e7a8a64ca8e4e3ec1bebb2bd298304812ac69) to return a 32-bit unsigned integer, matching its definition's contract. > - Adds explicit pointer conversions at each table-address consumer in `zi8InternalGetZH` and `Zi8NewMatchPhonetic` (phonetic, ordinal, character-range, frequency, filtered-search, pinyin, group, and candidate tables). > - Matching logic, control flow, and indexing are unchanged; object identity and DOL hashes were verified per [chinese-table-address-contract-20261003.md](https://github.com/coah80/wii-ipl/pull/1092/files#diff-bcaaeedd3b214aab2feed5afd86832a581387d22479bdf07a5332a40903405c4). > - Risk: none — pure type-contract alignment with no runtime behavior change. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 6d43f6a.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 11:18:21 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.