feat(libSceIcu): implement uprv_sortArray #19985
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19985"
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-14T10:13:30Z.
What
uprv_sortArrayis still a stub in libSceIcu, throwingNotImplemented_nid_no_patch. It is ICU's sort dispatcher fromcommon/uarrsort.cpp: argument checks, an insertion sort for stable sorts and for fewer than nine items, and ICU's semi-recursive quicksort otherwise.This PR implements it in a new file,
core/libs/prx/libSceIcu/ArraySort.cpp, following ICU 68.2'suarrsort.cpp:github.com/unicode-org/icu@84e1f26ea7/icu4c/source/common/uarrsort.cppDepends on #19972 (
uprv_stableBinarySearch), which the insertion sort calls. The first six commits of this branch are #19972's (up to4728c6bbe7); this PR's own seven commits start at5dc058330c, the argument-check and insertion-sort commit. Until #19972 merges, this PR's diff also shows its files.The history is incremental. Each step compiles and its tests pass:
NotImplementedfor non-stable sorts of nine or more items);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.Behaviour notes
UErrorCodevalues:U_ZERO_ERROR0 andU_ILLEGAL_ARGUMENT_ERROR1. A status that already holds a failure is left unchanged and the array is not touched.std::vector), not stack-allocated as in ICU.Tested
ctest -R '^guest_icu': 45 of 45 tests pass, includingguest_icu_array_sortandguest_icu_array_search.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 real caller of the sort helpers. Nothing is measured on the console; the debt doc says so.
Overlap
uprv_sortArrayin its title, body or diff.tools/pr_overlap.pyis expected to fail closed on the sharedCMakeLists.txt,LegacyExports.cpp,include/LegacyExports.hppanddocs/dev/debt/libSceIcu.md, as for the other libSceIcu PRs.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T10:32:09Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a8ad2c838d:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_array_search_tests,guest_icu_array_sort_testsbuilt cleanly.guest_icu_array_search,guest_icu_array_sort):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
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T11:00:57Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
28f524b4a9:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_array_search_tests,guest_icu_array_sort_testsbuilt cleanly.guest_icu_array_search,guest_icu_array_sort):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
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T17:21:37Z.
Review: COMMENTED
f6b04b64-15e0-4af5-83b6-c8595dcf468fReviewing files that changed from the base of the PR and between
9f52918eb0andd598bd8fd7.core/libs/prx/libSceIcu/ArraySearch.cppcore/libs/prx/libSceIcu/ArraySort.cppcore/libs/prx/libSceIcu/CMakeLists.txtcore/libs/prx/libSceIcu/LegacyExports.cppcore/libs/prx/libSceIcu/include/LegacyExports.hppcore/libs/tests/GuestIcuArraySearch.cppcore/libs/tests/GuestIcuArraySort.cppdocs/dev/debt/libSceIcu.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T04:41:06Z.
Review: COMMENTED
af54f6bf-8dfd-4b9e-87f5-c90bbee19b2bReviewing files that changed from the base of the PR and between
d598bd8fd7and442bd43d56.core/libs/prx/libSceIcu/CMakeLists.txtcore/libs/prx/libSceIcu/LegacyExports.cppcore/libs/prx/libSceIcu/include/LegacyExports.hppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T11:54:11Z.
Review: COMMENTED
Compiled the changed ICU array code with its two Linux fixtures against the existing PRXs.
GuestIcuArraySearchandGuestIcuArraySortpassed. The sort fixture covered stable insertion and merge paths and the nonstable quicksort path.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.