[libc-commits] [PATCH] D84875: [libc] Adds strrchr implementation.

Chris Gyurgyik via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jul 29 10:35:56 PDT 2020


cgyurgyik created this revision.
cgyurgyik added a reviewer: sivachandra.
Herald added subscribers: libc-commits, ecnelises, tschuett, mgorny.
Herald added a project: libc-project.
cgyurgyik requested review of this revision.

Thought process: A naive approach may first use strlen to find the string length, then memrchr to match. This is similar, but just does both in the same loop. Since '\0' is a valid character to match with, we need to ensure that it is checked after the comparison.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84875

Files:
  libc/config/linux/aarch64/entrypoints.txt
  libc/config/linux/x86_64/entrypoints.txt
  libc/src/string/CMakeLists.txt
  libc/src/string/strrchr.cpp
  libc/src/string/strrchr.h
  libc/test/src/string/CMakeLists.txt
  libc/test/src/string/strrchr_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84875.281661.patch
Type: text/x-patch
Size: 6330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200729/08f7b1be/attachment-0001.bin>


More information about the libc-commits mailing list