feat(libSceLibcInternal): implement __std_bitset_to_string_1 and _2 #15577
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15577"
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 GiannisG1 on 2026-11-03T19:51:34Z.
What
__std_bitset_to_string_1and__std_bitset_to_string_2(libSceLibcInternal, NIDs40rZnNs8g7AandxM78av0AYxM) were parameterless placeholders inRecoveredInventory.cppthat throw. They are Microsoft STL's helpers behindstd::bitset::to_string,vector_algorithms.cppL12179-L12226, at the commit #15460 cites. The signatures come from there:(char* destination, const void* bitset, size_t bits, char zero, char one), and the same with 16-bit elements, the guestwchar_t, for_2. The behaviour is the source's scalar loop, which its vector paths match: bitiof the bitset bytes, least significant first, is written todestination[bits - 1 - i]asoneorzero, and nothing else is written (no terminator). A null destination or bitset with a nonzero size throwsstd::invalid_argument, as #15460's helpers do for invalid ranges; a size of 0 writes nothing.The two functions move to
BitsetToString.cpp. The recovered-inventory debt entry now counts the remaining 7 placeholders, and a new entry records that the PS5 ABI and results are unmeasured.This is rebased onto #15460 (unsigned byte extrema), #16029 (
std::_Mtx_init_with_default_name_override), #16146 (the atomic wait deadline helpers), #15657 (signed and 16-bit integer extrema) and #15581 (float and double extrema), which implemented other placeholders of the same files. #15931 and #15822 change the same count line indocs/dev/debt/libSceLibcInternal.md. No function is implemented twice. Whichever lands later rebases, and I'll rebase this one if one of them lands first.Tested
Linux Mint 22.3, kernel 7.0.0-38, GCC 13.3.0, Release,
BUILD_TESTING=ON, head onmain56619b998c.guest_libc_internal_bitset_to_string(new) checks every output position for 1 to 130 bits and for 255, 256, 257, 1000 and 4096 bits, with both element types and four character pairs; guard elements on both sides stay untouched, set bits past the size in the last byte are ignored and the bitset is not modified. The output equals the host'sstd::bitset<N>::to_stringfor N = 1, 63, 64, 100 and 257. A size of 0 writes nothing, and null pointers with a nonzero size throw. On the placeholders it fails (__std_bitset_to_string_1_nid_postfix not implemented); with this PR it passes.All tests once and every GPU test on each of the three devices, under Xvfb: NVIDIA GeForce GTX 1050 Ti 4776 run, 2 failed; Intel HD Graphics 630 (Mesa 25.2.8) 1387 run, 11 failed; llvmpipe 1387 run, 2 failed. The new test passes. Against this PR's previous heads on
main69be504b67and532bd7981d, no result changed; of the testsmainadded since, all pass exceptagc_driver_vector_window_region, which skips on llvmpipe. The AGC tests that fail did so onmainbb13564449too, and so did this PR's previous head there. The one new failure, on all three, isguest_system_service_open_url(from #12895): it segfaults afterzenity: cannot open display, and it does the same onmain69be504b67without this PR (3 of 3).check_conventions.py,check_test_registration.py,check_main_sync.py(merges cleanly withmain164ac9b078),check_compile.py(3 translation units) andgit diff --checkare clean.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)🤖 Generated with Claude Code