feat(libSceIcu): implement UTF-16 comparisons #10963

Merged
AZLisme merged 7 commits from upstream-pr/10963 into main 2026-11-05 08:45:00 +00:00
AZLisme commented 2026-10-25 11:22:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AZLisme on 2026-10-25T11:22:03Z.


What

Implement u_strlen, u_strcmp, u_strncmp, u_memcmp and u_memcmpCodePointOrder using ICU 78.1 semantics and public ABI. Preserve code-unit differences, binary bounds through embedded NULs, surrogate-aware scalar ordering and terminated-string behavior for negative code-point comparison counts. Public declarations are reachable through libSceIcu.hpp; no ICU dependency is added.

Current head is 458afb0c5e4a6bbd5d4aa21d004674d2bc4a0c58. It incorporates B-Howell's preserving merge 32987f92 and frozen main 1e24993fa3a7da25e8fc27152af654687ba64552, retaining both sides of the CMake conflict and all landed ICU work. The comparison implementation, API header and fixture remain unchanged from the previous public head f2caeb1c.

#10962 actually merged on 2026-11-02; the declared prerequisite is fulfilled. This is the next PR in the agreed ICU landing order, followed by #10964 → #10965 → #10966 → #10967. No later open ICU topic is included.

The firmware 13.42 native-module report identifies ICU 78.1 but finds none of these five APIs among that module's exports. These older-inventory compatibility APIs remain; firmware availability/routing, console equivalence and invalid-pointer differences remain documented debt. These scope limitations are not additional repository merge requirements.

Tested

  • Current head 458afb0c5e4a6bbd5d4aa21d004674d2bc4a0c58 on frozen main 1e24993fa3a7da25e8fc27152af654687ba64552: fresh normal Linux x86-64/GCC 16.2.1 Release build of libc, libkernel, libSceIcu and the original ICU fixtures succeeded. All 16 ICU CTests and 65 public-header CTests passed, with zero failures or skips. This focused Linux build did not build all libraries, patch NIDs or run the patched-library loader test.
  • Independent review verified donor ancestry, preservation of current main, unique comparison exports and unchanged comparison implementation/API/fixture. Relative to frozen main this remains the original six-file comparison topic. python3 tools/check_conventions.py --base origin/main and the topic whitespace check pass.
  • Current-head upstream Windows run 41986007432, job 127106810140 tested exact 458afb0c with frozen main 1e24993f: 2,198 passed, 1,032 skipped, zero failed across 3,230 unique cases; all 16 ICU tests passed. Normal libraries, NID patching and fixtures actually built in the checked helper. Public-header and patched-library loader CTests were not selected there; the separate skip validator was skipped, so the 1,032 skips remain unexecuted and unaudited. The exact-head contributor-fork Windows job also passed 82/82 unique CTests: 16 ICU, one patched-library loader and 65 public-header tests, zero failures/skips/NotRun. It built the full normal libraries and all 17 original fixture targets, loaded 406 patched libraries with zero failures, and verified source identity, actual test selection/targets and complete JUnit results.
  • Historical upstream Windows run 41517042184, job 125528281323 tested previous head f2caeb1c with frozen main 096c4557: 2,022 passed, 957 skipped, zero failed; all 13 then-registered ICU cases passed. Headers and the skip validator were not run there. These historical results retain those inputs; skipped tests remain unexecuted.

No title runtime, console/native-firmware ABI or full-suite validation is claimed. Documented firmware/routing gaps remain debt, without adding an unrequested merge requirement.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #10962 (merged; prerequisite fulfilled)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5004252731 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10963). Originally posted by [AZLisme](https://github.com/AZLisme) on 2026-10-25T11:22:03Z. --- ### What Implement `u_strlen`, `u_strcmp`, `u_strncmp`, `u_memcmp` and `u_memcmpCodePointOrder` using [ICU 78.1 semantics and public ABI](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ustring.cpp). Preserve code-unit differences, binary bounds through embedded NULs, surrogate-aware scalar ordering and terminated-string behavior for negative code-point comparison counts. Public declarations are reachable through `libSceIcu.hpp`; no ICU dependency is added. Current head is `458afb0c5e4a6bbd5d4aa21d004674d2bc4a0c58`. It incorporates B-Howell's preserving merge `32987f92` and frozen main `1e24993fa3a7da25e8fc27152af654687ba64552`, retaining both sides of the CMake conflict and all landed ICU work. The comparison implementation, API header and fixture remain unchanged from the previous public head `f2caeb1c`. #10962 actually merged on 2026-11-02; the declared prerequisite is fulfilled. This is the next PR in the agreed ICU landing order, followed by #10964 → #10965 → #10966 → #10967. No later open ICU topic is included. [The firmware 13.42 native-module report](https://github.com/boykopovar/AnyPS5/pull/10963#issuecomment-6400072356) identifies ICU 78.1 but finds none of these five APIs among that module's exports. These older-inventory compatibility APIs remain; firmware availability/routing, console equivalence and invalid-pointer differences remain documented debt. These scope limitations are not additional repository merge requirements. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Current head `458afb0c5e4a6bbd5d4aa21d004674d2bc4a0c58` on frozen main `1e24993fa3a7da25e8fc27152af654687ba64552`: fresh normal Linux x86-64/GCC 16.2.1 Release build of libc, libkernel, libSceIcu and the original ICU fixtures succeeded. All **16 ICU CTests and 65 public-header CTests passed**, with zero failures or skips. This focused Linux build did not build all libraries, patch NIDs or run the patched-library loader test. - Independent review verified donor ancestry, preservation of current main, unique comparison exports and unchanged comparison implementation/API/fixture. Relative to frozen main this remains the original six-file comparison topic. `python3 tools/check_conventions.py --base origin/main` and the topic whitespace check pass. - Current-head upstream Windows [run 41986007432, job 127106810140](https://github.com/boykopovar/AnyPS5/actions/runs/41986007432/job/127106810140) tested exact `458afb0c` with frozen main `1e24993f`: **2,198 passed, 1,032 skipped, zero failed** across 3,230 unique cases; all **16 ICU tests passed**. Normal libraries, NID patching and fixtures actually built in the checked helper. Public-header and patched-library loader CTests were not selected there; the separate skip validator was skipped, so the 1,032 skips remain unexecuted and unaudited. The exact-head [contributor-fork Windows job](https://github.com/AZLisme/AnyPS5/actions/runs/41985682543/job/127105738478) also passed **82/82 unique CTests**: **16 ICU, one patched-library loader and 65 public-header tests**, zero failures/skips/NotRun. It built the full normal libraries and all 17 original fixture targets, loaded **406 patched libraries with zero failures**, and verified source identity, actual test selection/targets and complete JUnit results. - Historical upstream Windows [run 41517042184, job 125528281323](https://github.com/boykopovar/AnyPS5/actions/runs/41517042184/job/125528281323) tested previous head `f2caeb1c` with frozen main `096c4557`: 2,022 passed, 957 skipped, zero failed; all 13 then-registered ICU cases passed. Headers and the skip validator were not run there. These historical results retain those inputs; skipped tests remain unexecuted. No title runtime, console/native-firmware ABI or full-suite validation is claimed. Documented firmware/routing gaps remain debt, without adding an unrequested merge requirement. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> #10962 (merged; prerequisite fulfilled) - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-10-25 11:59:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T11:59:51Z.

Review: APPROVED


Reviewed the five implementations and tests against the pinned ICU 78.1 source, and ran a local differential harness against the installed ICU 72.1 implementation. 12,223,143 exact return-value comparisons matched across 729 short UTF-16 inputs built from NUL, BMP boundaries, and paired/unpaired surrogate units, with counts -7, -1, 0, 1, 2, 3 and 4. This covered u_strlen, u_strcmp, u_strncmp, u_memcmp, and u_memcmpCodePointOrder; the local harness compiled with C++20 and -Wall -Wextra -Werror. git diff --check and the repository conventions check also pass on this head.

No semantic blocker found in this PR. Its declared dependency on #10962 is still open with changes requested, so this approval does not remove that prerequisite; keep the two topics coordinated and land/rebase this integration after the predecessor is resolved. Hosted eligibility, conventions, intake, labels and report checks pass. Product build/test jobs are skipped by repository policy, and the console behavior remains unverified as documented.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643115401 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10963#pullrequestreview-5643115401). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T11:59:51Z. **Review:** APPROVED --- Reviewed the five implementations and tests against the pinned ICU 78.1 source, and ran a local differential harness against the installed ICU 72.1 implementation. **12,223,143 exact return-value comparisons matched** across 729 short UTF-16 inputs built from NUL, BMP boundaries, and paired/unpaired surrogate units, with counts -7, -1, 0, 1, 2, 3 and 4. This covered `u_strlen`, `u_strcmp`, `u_strncmp`, `u_memcmp`, and `u_memcmpCodePointOrder`; the local harness compiled with C++20 and `-Wall -Wextra -Werror`. `git diff --check` and the repository conventions check also pass on this head. No semantic blocker found in this PR. Its declared dependency on #10962 is still open with changes requested, so this approval does not remove that prerequisite; keep the two topics coordinated and land/rebase this integration after the predecessor is resolved. Hosted eligibility, conventions, intake, labels and report checks pass. Product build/test jobs are skipped by repository policy, and the console behavior remains unverified as documented.
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
boykopovar/AnyPS5!10963
No description provided.