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

Chris Gyurgyik via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 4 05:10:42 PDT 2020


cgyurgyik added inline comments.


================
Comment at: libc/src/string/strspn.cpp:32-40
+  if (!segment[0])
+    return 0;
+
+  const char *initial = src;
+  if (!segment[1]) { // The segment is a single character.
+    for (; *src == *segment; ++src)
+      ;
----------------
I believe I accidentally resolved this, but
@abrachet 's comment from earlier: 


> The difference in speed here is going to be negligible, the question is whether you think it is worth complicating the code for these edge cases.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85103/new/

https://reviews.llvm.org/D85103



More information about the libc-commits mailing list