feat(libSceIcu): implement the numeric platform helpers #11088
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11088"
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 mantavisual on 2026-10-25T17:23:52Z.
What
Implements 24
libSceIcuexports from the PS5 3.20 export table: ICU's numeric platform helpers. None of them needs Unicode data.uprv_isNaN,uprv_isInfinite,uprv_isPositiveInfinity,uprv_isNegativeInfinity,uprv_getNaN,uprv_getInfinityuprv_floor,uprv_ceil,uprv_fabs,uprv_modf,uprv_fmod,uprv_pow,uprv_pow10,uprv_loguprv_round,uprv_truncuprv_fmax,uprv_fmin,uprv_max,uprv_min,uprv_maxMantissauprv_add32_overflow,uprv_mul32_overflow,uprv_maximumPtrThey follow ICU 78.1's putil.cpp and umath.cpp. Firmware 13.42 reports ICU 78.1 (#11013), and the 3.20 export table points to 65–68. The bodies,
u_signBitand the NaN and infinity bit patterns are identical in 65.1, 66.1, 67.1, 68.1, 68.2 and 78.1, apart from C++ casts. Signatures are fromputilimp.h, whereUBoolisint8_tin all of them. All 24 are in the 3.20 table, but BunnyFl's complete 13.42 list shows firmware 13.42 exports none of them; the debt entry says so. The code assumes ICU's default x86-64 configuration (IEEE_754set, defaultU_MAX_PTR).floor,ceil,fabs,modf,fmod,powandlog, as ICU calls the console's libc, so their precision is libc's.uprv_truncreturns positive infinity for negative infinity.uprv_fmax,uprv_fminanduprv_truncreturn the canonical quiet NaN0x7ff8000000000000, not the NaN they were given.uprv_fmax(0.0, -0.0)is-0.0.uprv_roundfloorsx + 0.5, so0.49999999999999994rounds to 1.uprv_maximumPtradds0x7fffffffand saturates at the top of the address space.uprv_modfintegral pointer and a null overflow result pointer throwAPS5_INVALID_ARG_EX, since ICU dereferences them.The debt entry is a second entry in
docs/dev/debt/libSceIcu.md.Depends on #10967. As agreed with AZLisme, this merges after #11013 and the #10961 → … → #10967 chain, because all of them add to the new
CMakeLists.txt,libSceIcu.hppand debt file. The branch is stacked on #11013 for now, so the diff also shows its commits; I'll rebase it ontomainafter #10967 merges. This PR's own commits are2098426fbf,a43b228a4a, and the three debt-wording commits ending at4489d407a8. The second makes the test build on LP64 Linux, wherestd::uint64_tisunsigned longand a mixed braced list could not deduce one type. AZLisme found and supplied that fix.Tested
Windows 11 Pro 23H2, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, on #11013 (37d5137ea0, based onmaine05ba6feeb).guest_icu_numeric:DBL_MAX, plus the exact NaN and infinity bit patterns.pow10of negative and overflowing exponents andlogof 0 and −1.roundat halves, at −0.5 (positive zero) and at0.49999999999999994;truncsigned zeros, both infinities and NaN.fmax/fminwith NaN on either side and all four signed-zero orderings.max/minat theint32_textremes.INT32_MIN * -1.maximumPtrat 0, at 0x1000, at the exact top and when wrapping.ctest -R "guest_icu_|patched_libraries": all 3 pass (guest_icu_versionfrom #11013 included). The NID-patchedlibSceIcu.prxbuilds with 29 NID exports.tools/progress.py --module libSceIcu: 29 implemented, 0 stubs.tools/check_test_registration.py build: 1342 test executables, none built and not run.python3 tools/check_conventions.py --base origin/mainpasses. Overlap: no open PR implements or names anyuprv_function (checked 2026-10-25, including the diffs of #10961–#10967).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 MarcZX10 on 2026-10-25T17:27:13Z.
Review: APPROVED
Reviewed the new numeric implementation and its tests against ICU 68.2’s putil.cpp and putilimp.h. The IEEE classification, round/trunc behavior, NaN and signed-zero handling, overflow-result wrapping,
uprv_maxMantissa, andU_MAX_PTRsaturation match the cited implementation/configuration. The boundary and exceptional cases are covered inGuestIcuNumeric.cpp.The PR reports the focused Windows 11/WinLibs GCC 15.2 CTest run; current exact-head eligibility, conventions, intake, labels and report checks pass. Hosted product jobs are skipped by path policy. The dependency on #11013 is explicit, and #11013 now has a review approval and agreed shared-file landing order. Approved.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T17:41:33Z.
Review: APPROVED
Re-reviewed at
2098426fbf9577e7c0b425bca0e2130162288587. Since my prior approval, the code undercore/libs/prx/libSceIcuis unchanged; the only change is the debt wording incorporating the firmware 13.42 ICU 78.1 evidence and clarifying that export status for these numeric helpers was not checked. That accurately limits the claim. The agreed merge order remains #11013 first, and #11013 is still open with its approval and checks passing. Current conventions, labels, eligibility, and report checks pass; product test jobs are path-skipped. Re-approving this exact head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:02:15Z.
Review: CHANGES_REQUESTED
The numeric implementation itself remains approved at this exact head; I am requesting only the unresolved integration-order correction required by the repository PR workflow. The current diff conflicts with the exact heads of #10961 and #10967 in the shared library CMake file, umbrella header and debt file. The existing agreement orders #11013 followed by the #10961–#10967 chain, but does not place this PR in that sequence, while its checklist lists only #11013. Please coordinate an order with @AZLisme and update
Depends onto the actual predecessor before treating this review as clear. Details and exact merge-tree result are in my comment.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:23:54Z.
Review: CHANGES_REQUESTED
The production sources compile, but the new numeric test currently does not compile with GCC 12.2 on Linux. Reproduced on exact head
2098426fbf9577e7c0b425bca0e2130162288587usingg++ -std=c++20 -Icore/libs -fsyntax-only core/libs/tests/GuestIcuNumeric.cpp: the range-for initializer atGuestIcuNumeric.cpp:42mixesstd::uint64_t(unsigned long on LP64) withullliterals (unsigned long long), so the compiler cannot deduce one initializer-list element type. Please give this range an explicitstd::array<std::uint64_t, 5>type or cast the constants, then rerun the target test/build. The other changed translation units andGuestIcuVersion.cpppass syntax checks here; conventions andgit diff --check upstream/main...HEADpass. The hosted Linux build was skipped for this path, while the reported Windows focused tests pass.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T10:21:39Z.
Review: CHANGES_REQUESTED
Re-reviewed exact head
4489d407a86d786b36c5187813908a6e139ae8ceagainst currentmainf99d7fece316e31878f0195f8bbc2ad2fbe635e4.The earlier findings are resolved at the reported head: the LP64 initializer-list fix is present, and the stack order is agreed as #11013 → #10961–#10967 → #11088, with
Depends on: #10967. #11013 has merged; #10967 remains open. The implementation and firmware-availability wording have no new issue in this re-check.The remaining integration is still blocked. The current-main merge preview conflicts in
core/libs/prx/libSceIcu/CMakeLists.txtanddocs/dev/debt/libSceIcu.md; currentmainhas changed the ICU CMake, umbrella header, and debt files since the branch base. The overlap report also identifies newer ICU PRs touching these shared files. After #10967 lands, please rebase this stack onto currentmain, coordinate any remaining shared-file order with those authors, and rerunguest_icu_numericplus conventions on the exact integrated head. The Linux result currently cited is from the earlier #11013-based stack, not the current integration.git diff --checkand current-main conventions pass on the unmerged diff, but they do not resolve the merge conflict or replace the focused run. Hosted product jobs are skipped; I did not run a local build/test. Changes requested only for the remaining integration and current-head validation.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T18:42:44Z.
Review: APPROVED
Re-checked — new head, looks good
The rebased exact head builds cleanly, and its focused numeric test passes under QEMU with the CPU features required by the project.
What I ran
15f0acfdf1b1aaf57c1cc19d570b6089df3f69caagainst currentmainbb04a4f1ea0175e9e4f149f0359a764d62ff3296; GitHub reports the PR mergeable and clean.-cpu max.git diff --check.Results
Unedited build and QEMU output
Unedited direct CTest output
Unedited conventions output
Negative control
uprv_isNaNto return 0Findings
Blocking
None found.
Non-blocking
Console behavior is not independently verified. The patch documents the ICU 78.1 source/configuration basis and keeps the firmware comparison as a verification debt.
Sources
Not verified