feat(libSceIcu): implement uprv_stableBinarySearch #19972
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19972"
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:56:23Z.
What
uprv_stableBinarySearchis still a stub in libSceIcu, throwingNotImplemented_nid_no_patch. It is ICU's stable binary search fromcommon/uarrsort.cpp, which the sort helpers use for insertion sort.This PR implements it in a new file,
core/libs/prx/libSceIcu/ArraySearch.cpp, following ICU 68.2'suarrsort.cpp:github.com/unicode-org/icu@84e1f26ea7/icu4c/source/common/uarrsort.cppIt keeps ICU's behaviour: a linear scan below nine elements, a binary search above that, the last occurrence of equal items, and the complement of the insertion point for absent items. The comparator is called directly, the same way libc's
qsortcalls its comparator.History: the implementation commit (stub removed, declaration given the real signature, CMake source added), then one test commit per behaviour, then the documentation commit. The first test commit also registers
guest_icu_array_searchinCMakeLists.txt.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.Tested
4728c6bbe7.ctest -R '^guest_icu': 44 of 44 tests pass, including the newguest_icu_array_search.int32_tarrays and pins: a unique value's index; the complement of the insertion point for an absent value; the last occurrence among duplicates (index 13 in a 20-element array with a run of 5s); the linear path for a three-element array; an empty array; and keys below and above both a nine-element and a twelve-element array.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 caller of the sort helpers. Nothing is measured on the console; the debt doc says so.
Overlap
tools/pr_overlap.py --branchis expected to fail closed on the sharedCMakeLists.txt,LegacyExports.cpp,include/LegacyExports.hppanddocs/dev/debt/libSceIcu.md, as it does 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)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T10:08:24Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
4728c6bbe7:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_array_search_testsbuilt cleanly.guest_icu_array_search):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:29:39Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
bc2723f31f:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_array_search_testsbuilt cleanly.guest_icu_array_search):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:00:54Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
5b6652ad46:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_array_search_testsbuilt cleanly.guest_icu_array_search):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 ligmaSec on 2026-12-03T11:54:14Z.
Review: COMMENTED
Compiled the changed ICU array code with
GuestIcuArraySearchagainst the existing Linux PRXs. It passed the last-duplicate, insertion-point, empty-array, and threshold cases.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.