feat(libSceFreeType): implement the fixed-point square root #11996
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11996"
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 santhoshkumar-dev on 2026-10-27T16:03:43Z.
What
Add
FT_SqrtFixed(JgtSc0g3G6E) to the physicallibSceFreeTypeadapter. Its signed 32-bit interface returns zero for nonpositive inputs; for positive inputs the result isfloor(sqrt(bits << 16)), the 16.16 fixed-point integer square root. An independently authored bounded search uses 64-bit products; no third-party code is copied.The name/NID is in the PS5 3.20 inventory (alongside
FT_Sqrt32). The signed contract and nonpositive-input zero follow legacy FreeType 2.4.12 ftcalc.c; the bundled 2.13.3 build exports only an unsigned variant, so it is not forwarded to. Console ABI/arithmetic equivalence is unverified and recorded in debt.The matching OT inventory helper is named
sceFreeTypeOtSqrtFixed_nid_no_patchand declared in the public header reachable through its umbrella. Its existing no-parameter placeholder, explicit NID alias and throwing behavior remain; this is not an OT-provider implementation or a claim about its console prototype. Implementation and tests include the canonical square-root header.Ordering: whole-branch comparisons at this head against current main
e0cd1259a95e6dfaf97f8f73e74410bbc5d8d199and against #11613 are clean. #11878 and this branch both add one include line at the sameinclude/Api.hppspot and conflict only there (both lines are kept on rebase);CMakeLists.txt,libSceFreeTypeOt/Export.cppand the debt entry auto-merge. No code from that PR is included and there is no functional or build dependency. Whole-branch combinations with #9465 and #10897 conflict indocs/dev/debt/libSceFreeTypeOt.mdonly; baseline comparisons of those heads against current main produce exactly that same conflict, and this PR does not change that file. Neither peer changes the square-root export; open/closed/merged history was rechecked forFT_SqrtFixed/JgtSc0g3G6Eimmediately before opening, with no match.Tested
Submitted and tested head
dbd9df9e946bb3107812511e60f1ced8aaa46c6d, based on upstream main2222bae20b123d4545c7c70a0bbe388e9c8c29c1; it merges cleanly into current maine0cd1259a95e6dfaf97f8f73e74410bbc5d8d199with no files changed by this contribution touched since.Windows 11 x64 / WinLibs GCC 15.2.0 r7 and local Ubuntu 24.04.1 x86-64 under WSL2 / GCC 13.3.0 / glibc 2.39: Ninja Release, bundled dependencies,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=OFF. On each platform the completelibstarget (including all packaged-NID.prxpatching) and selected test executables build, and 70/70 CTests pass: public-header audit, all 64 header compilation batches, both square-root export modes (unpatched symbol and packaged NIDJgtSc0g3G6E), charmap checks and the packaged-library loader.The fixture resolves the actual unpatched symbol and packaged NID separately. Each mode checks zero for
0,-1,-65536andINT32_MIN; exact fixed points65536 -> 65536and262144 -> 131072; the first and last input and the preceding transition of every non-empty result interval across the full positive domain (11,863,284 result values, covering the maximum input0x7FFFFFFF); and 65,536 deterministic LCG samples verified by square inequalities. Outside the repository, an exhaustive harness compared this implementation with the legacy 2.4.12 digit-by-digit algorithm over every positiveint32input plus negatives andINT32_MIN: zero mismatches.No full application/test-suite, macOS, title or physical-console run is claimed.
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)Pull request closed