[libc-commits] [PATCH] D85103: [libc] Adds strspn implementation.

Chris Gyurgyik via Phabricator via libc-commits libc-commits at lists.llvm.org
Sun Aug 2 17:47:42 PDT 2020


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

[libc] Adds strspn implementation. To get O(max(M,N)) complexity (where M, N are the string lengths), one can use a table to first store the characters of the string to be matched against, and then iterate over the source string to determine if it contains any.

This approach takes it a step further, and reduces the table's size by using bit manipulation techniques.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85103

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85103.282489.patch
Type: text/x-patch
Size: 8547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200803/0784c676/attachment.bin>


More information about the libc-commits mailing list