feat(libc): implement atol #1868
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1868"
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 TheAggie on 2026-10-08T22:27:41Z.
What
atolwas not exported. The homebrew Puzzles collection (PPSA99006) calls it before reaching its main menu.The guest's
longis 64-bit, but the host'slongis 32-bit on Windows, soatolparses withstrtollinstead of the hostatol. Base 10, leading whitespace and a sign, stopping at the first non-digit, as C requires.core/libs/prx/libc/src/Strings.cpp:atol.guest_mathtest: a value belowINT32_MINwith leading whitespace and trailing text,INT64_MAXwith a plus sign,0x10(0, since it is base 10), and an empty string.Related: #1852 implements
atollin libSceLibcInternal; this isatolin libc, so the two don't overlap.Tested
Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.
mainwith this PR and four other small libc/libkernel PRs of mine merged together (atol, getprogname, dup2, ctime/rewind, pthread_set_name_np). It was run from the generatedCTestTestfile.cmakecommands because antivirus blocksctest.exeon this machine.tools/check_conventions.py --base origin/mainpasses on this branch alone.Not tested on Linux or macOS.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T22:29:13Z.
Progress report (
ce64d8e→0074362)➖ System libraries: 84.76% (+0.0%, +1 implemented functions)
✅ 1 implemented
atol_nid_postfixImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-09T02:46:39Z.
Review: COMMENTED
Verified on Linux — the differential holds, which is the half the "Tested" line could not cover.
cmake --build build --target guest_math_tests --parallel 16→ clean; the binary runs and passes, exit 0.mainwith the new test kept → the target fails to link:So the test cannot even run without the export, and its behavioural assertions are what carry the rest.
Claim cross-check:
atolisstd::strtoll(str, nullptr, 10)(Strings.cpp:154) — base 10, withstrtoll's sign, leading-whitespace and first-non-digit behaviour, and 64-bit regardless of the host'slongwidth. That last part is the reason the body gives for not handing this to the hostatol, and it is the right call on a platform whoselongis 32 bits.The titles are named (Puzzles PPSA99006) — that is exactly the part reviewers ask for, and it is here.
Not verified: Windows (the author's platform), and behaviour beyond what this test asserts.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:30:13Z.
Closing: Puzzles (PPSA99006) stops at
mkstempon main (#1613), beforeatol. Reopen whenatolis a title's next stop on main, with the log line.Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T04:49:15Z.
ProsperoPuzzles (PPSA99006) and PSBox (PPSA99810) now stop at
atolonmain(per @babyhuey's runs on #2186). #2186 by @AchrafReyani implements bothatolandatollwith that evidence, so it covers more than this PR. I'll leave this one closed in favour of #2186.AI-assisted (Claude Code).
Pull request closed