feat(libc): implement memrchr #1592

Closed
MarcZX10 wants to merge 2 commits from upstream-pr/1592 into main
MarcZX10 commented 2026-10-08 13:57:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T13:57:34Z.


What

Implement the byte-wise reverse search used by memrchr, including conversion of the search value to unsigned char. Add a dedicated guest test for repeated matches, bounded searches, high byte values, and misses.

Tested

Linux, GCC 12.2.0: guest_memrchr passed; conventions check and git diff --check passed.

Checklist

  • Based on current main; no open PR implements memrchr
  • One topic per PR; test is isolated from GuestStrings.cpp changes in #1490
  • No comments or investigation files added
  • Generic POSIX behavior
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4787902874 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1592). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-08T13:57:34Z. --- ### What Implement the byte-wise reverse search used by `memrchr`, including conversion of the search value to `unsigned char`. Add a dedicated guest test for repeated matches, bounded searches, high byte values, and misses. ### Tested Linux, GCC 12.2.0: `guest_memrchr` passed; conventions check and `git diff --check` passed. ### Checklist - [x] Based on current `main`; no open PR implements `memrchr` - [x] One topic per PR; test is isolated from `GuestStrings.cpp` changes in #1490 - [x] No comments or investigation files added - [x] Generic POSIX behavior - [x] Depends on: none - [x] AI-assisted: yes
oneandonlydean commented 2026-10-08 19:20:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T19:20:08Z.


No title reaches memrchr on main yet: the homebrew audit lists the import, but those titles stop earlier at other missing imports. Closing for now; reopen when it's a title's next stop on main, with the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6067325517 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1592#issuecomment-6067325517). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T19:20:08Z. --- No title reaches `memrchr` on main yet: the homebrew audit lists the import, but those titles stop earlier at other missing imports. Closing for now; reopen when it's a title's next stop on main, with the log line.
Amirtheshwaran commented 2026-10-10 19:04:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amirtheshwaran on 2026-10-10T19:04:26Z.


@MarcZX100 heads-up: with #1848, #2090, #1772, #1650 and #1624 merged, PICO-8 for PS5 (PPSA99808) now stops at memrchr (5G2ONUzRgjY) on main, per @babyhuey's startup check on #1772: https://github.com/boykopovar/AnyPS5/pull/1772#issuecomment-6097664778. That's the condition Dean set for reopening this.

I had #1906 for the same import; yours came first, so I'll leave it to you. If you'd rather not pick it up, let me know and I'll reopen mine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101115020 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1592#issuecomment-6101115020). Originally posted by [Amirtheshwaran](https://github.com/Amirtheshwaran) on 2026-10-10T19:04:26Z. --- @MarcZX100 heads-up: with #1848, #2090, #1772, #1650 and #1624 merged, PICO-8 for PS5 (PPSA99808) now stops at `memrchr` (`5G2ONUzRgjY`) on `main`, per @babyhuey's startup check on #1772: https://github.com/boykopovar/AnyPS5/pull/1772#issuecomment-6097664778. That's the condition Dean set for reopening this. I had #1906 for the same import; yours came first, so I'll leave it to you. If you'd rather not pick it up, let me know and I'll reopen mine.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1592
No description provided.