feat(libSceIcu): implement the three UComparator helpers from ICU 68.2 #19955
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19955"
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?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T09:29:54Z.
What
Three libSceIcu exports are still stubs that throw
NotImplemented_nid_no_patch:uprv_int32Comparator,uprv_uint32Comparatoranduprv_uint16Comparator. They are ICU'sUComparatorhelpers fromcommon/uarrsort.cpp, with the ICU 68 names already used for their NIDs inLegacyExports.cpp.This PR implements them in a new file,
core/libs/prx/libSceIcu/ArrayComparators.cpp, following ICU 68.2'suarrsort.cpp:github.com/unicode-org/icu@84e1f26ea7/icu4c/source/common/uarrsort.cppEach comparator is one commit: implementation, with its stub removed and its declaration given the real
(context, left, right)signature. Then one test commit per comparator, the first of which also registersguest_icu_array_comparatorsinCMakeLists.txt. The last commit updatesdocs/dev/debt/libSceIcu.md.Behaviour note
ICU computes
*left - *rightinint32_t, which overflows for some inputs. That is undefined in C++. This implementation subtracts as unsigned and converts back, which gives the two's-complement result ICU's builds produce. The tests pin exact differences and ordering without overflow; they do not pin the overflowing cases. The debt entry says so.Licence (please confirm)
The adapted code comes from ICU, distributed under the Unicode licence (
icu4c/LICENSE, linked from the file header). This repository is GPL-2.0. The author of this PR believes the Unicode licence is compatible; maintainers should check before merging. The header ofArrayComparators.cppkeeps ICU's copyright notice and the pinned licence link.Tested
15eaa77443.ctest -R '^guest_icu': 44 of 44 tests pass, including the newguest_icu_array_comparators.int32(for example-1vs1gives-2), ordering and equality foruint32including0xFFFFFFFF, anduint16differences over the full 16-bit range (0xFFFFvs0gives65535).tools/check_conventions.py --base upstream/main: passed.git diff --check: empty.tools/pr_precheck.py(no-build): see the comment on this PR.Not run: the console, Windows, macOS, and any sorting caller. No behaviour is measured on the console; the debt doc says so.
Overlap
tools/pr_overlap.py --branchfails closed:CMakeLists.txt,LegacyExports.cpp,include/LegacyExports.hppanddocs/dev/debt/libSceIcu.mdare shared with many open PRs, so the tool could not complete the comparison. A textual conflict with a neighbouring hunk in another PR is still possible; it would be resolved by rebasing this branch.LegacyExportsand the CMake list, so whichever merges second may need a rebase.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T09:38:39Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
15eaa77443:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_array_comparators_testsbuilt cleanly.guest_icu_array_comparators):core/libs/prx/libSceIcu/LegacyExports.cpp,core/libs/prx/libSceIcu/include/LegacyExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T10:39:25Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
4f4b41a1d2:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_array_comparators_testsbuilt cleanly.guest_icu_array_comparators):core/libs/prx/libSceIcu/LegacyExports.cpp,core/libs/prx/libSceIcu/include/LegacyExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T11:31:16Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
1d0a0e35ee:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_array_comparators_testsbuilt cleanly.guest_icu_array_comparators):core/libs/prx/libSceIcu/LegacyExports.cpp,core/libs/prx/libSceIcu/include/LegacyExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me