Repository navigation
feat(libc): implement unsigned 64-bit minimum - #11289
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 94e88881d482031d47178adcbe87a58212d3a304. The unsigned 64-bit minimum implementation handles the nonempty range through the existing Read helper, including unaligned inputs; the added tests cover boundaries, random vectors, offsets, and guard/canary behavior. I found no concrete correctness issue in the diff.
The author reports Windows and WSL builds/differential tests (8,609 cases). Hosted conventions, eligibility, intake, labels, Ubuntu/macOS/Windows relinker, ASan, register-context, and write-watch checks pass. Full Linux and Windows product builds were path-skipped. I did not independently rerun the author’s local differential tests.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows run of head AI-assisted: yes (Claude Code); results above were run on this machine. |
What
Add the missing libc export
__std_min_8u(i8DeU1sI6I4). It reads a nonempty range of unsigned 64-bit elements and returns the minimum value, rather than a pointer. Reads use the existingmemcpyhelper, so the range need not be aligned; the input is left untouched. Null, empty, reversed or partial-element ranges callNotImplemented_nid_no_patch; their native failure behavior is not reproduced and remains in debt. The test does not assert those unsupported paths.The contract comes from the
libc.prxbundled with PPSA03671 v01.001.005: export RVA0x62a30, size0x2a4, ELF SHA256483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6. Its implementation takesrdi/rsirange pointers, reads 8-byte elements, selects the unsigned smaller value (cmovbat0x62cc6in the scalar tail), and returns the value inrax. The isolated original function was also executed on this Windows host from its mapped load segments, using its image-relative constants without relocations, module initialization or other module exports. This is a host differential, not a console measurement. Microsoft STL's public implementation corroborates the unsigned value-returning signature.Declare the export once in libc's public
Api.hpp; tests use that header. No third-party code, module bytes or title files are added. No current title dependency or title unblock is claimed.Tested
Base:
acb900c194325b9ee8c23c10768a9a491454f0b2. Published/tested head:94e88881d482031d47178adcbe87a58212d3a304.BUILD_TESTING=ON,ANYPS5_RELINKER_ONLY=OFF,SDL_CCACHE=OFF. Built productionlibs,relinkerandguest_vector_algorithms_tests.guest_vector_algorithmspasses on the unmodified base. Added cases cover unsigned/sign and 32/64-bit boundaries, a single value, repeated minima, lengths around vector/tail boundaries, offsets 0–31, input/canary preservation, all-maximum ranges and a unique minimum at every position. All existing cases remain.ctest --test-dir build -R "^(guest_vector_algorithms|public_headers)$" -V --output-on-failure: both pass on Windows. The public-header audit verifies unique declarations and umbrella coverage; this is not a claim that all standalone-header compilation batches or the full CTest suite ran.UINT64_MAX, and all 64 pairs of eight unsigned edge values. Inputs remain unchanged. Repeated against the final production binary after restoration.guest_vector_algorithms_testsbuild; the same CTest expression passes both tests. A separate Git checkout fixed to the published commit is clean for the tested sources before and after the run. The existing runtime reported unavailable asynchronous userfaultfd write protection and used its memory-comparison fallback.Overlap: the required scan against
acb900c194325b9ee8c23c10768a9a491454f0b2reports no confirmed overlap. Manually inspected all 29 stale shared-file comparisons against their merge bases: #5021, #5303, #6713, #7081, #7386, #7447, #7544, #7648, #7715, #8150, #8417, #9269, #9371, #9447, #9526, #9669, #9771, #9863, #9873, #9929, #10007, #10113, #10226, #10405, #10467, #10610, #10742, #10788, #10898. Their changes touch other debt entries; #10742 adds_LCosh/_LSinhdeclarations and #10788 adds_Thrd_lt, away from this declaration. None changes this export or the adjacent vector-algorithm entry. Those stale branches are not claimed merge-clean. A trialmerge-treewith #10460 (62c85f44a6a50b0ffb6ae72e7d6405c5a8c7769f, unsigned maximum) succeeds without content conflicts; the two exports are independent.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)