feat(libc): implement ldiv #1818
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1818"
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 DariusHQ on 2026-10-08T20:19:47Z.
What
ldiv(gfP0im5Z3g0) is absent from the libc exports. RetroArch (PPSA99169) imports it fromlibSceLibcInternal, one of the absent imports that #1578 lists for that title. Part of #1578; no open PR implements it.The guest
longis 64-bit, so the export takesstd::int64_tand returnslldiv_t, whose layout matches the guestldiv_t(two 64-bit members), the same waylldivis exported.std::ldivwould truncate on Windows, wherelongis 32-bit.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, full build with
BUILD_TESTING=ONon4b6ab6bb:ctest479/479 passed, and the builtlibc.prxexportsgfP0im5Z3g0.guest_mathcomparesldivwithlldivfor ±4294967301 divided by ±3, which a 32-bitlongwould truncate, and checksINT64_MIN / 2. Not tested on Linux. No title run: PPSA99169 still has other absent imports.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by DariusHQ on 2026-10-09T19:29:31Z.
The overlap with #2038 is gone. #2038 moved its
lrand48andsrand48checks fromGuestMath.cpptoGuestRand48.cppincf569548. The bot comment stays becausetools/pr_overlap.pylists only the 200 newest open pull requests (gh pr list -L 200), and #1818 is older, so the workflow no longer updates or deletes it.pr_overlap.py --branchon8b393b6ereports one overlap, with #2316 (abs): both add their export afterlldivinMath.cppand their checks at the same lines ofGuestMath.cpp. Whichever merges second keeps both sides. I will rebase this one if #2316 goes firstImported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-09T19:47:15Z.
Thanks for the heads-up! My PR #2316 is pretty much ready to go. You can rebase it once yours gets merged, or if you’d prefer to merge yours first, just let me know and I’ll take care of the rebase on my end.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:02:39Z.
Checked:
ldivNIDgfP0im5Z3g0matchescompute_nid;lldiv_thas the same layout as the guestldiv_t(two 64-bit members) and the fixed-widthint64_tsignature avoids the 32-bitlongtruncation on Windows.guest_mathpasses with the PR and fails to link without theMath.cppchange. Merging once CI is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:14:18Z.
Progress report (
364a56b→668a1e6)➖ System libraries: 84.76% (+0.0%, +1 implemented functions)
✅ 1 implemented
ldiv_nid_postfix