[libc-commits] [PATCH] D144995: [libc] Fix strcspn

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Feb 28 11:42:00 PST 2023


abrachet created this revision.
abrachet added reviewers: michaelrj, sivachandra, lntue.
Herald added subscribers: ecnelises, tschuett.
Herald added a project: All.
abrachet requested review of this revision.

https://reviews.llvm.org/D144995

Files:
  libc/src/string/string_utils.h


Index: libc/src/string/string_utils.h
===================================================================
--- libc/src/string/string_utils.h
+++ libc/src/string/string_utils.h
@@ -166,8 +166,8 @@
   cpp::bitset<256> bitset;
 
   for (; *segment; ++segment)
-    bitset.set(*segment);
-  for (; *src && !bitset.test(*src); ++src)
+    bitset.set((uint8_t)*segment);
+  for (; *src && !bitset.test((uint8_t)*src); ++src)
     ;
   return src - initial;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144995.501243.patch
Type: text/x-patch
Size: 454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230228/0904895b/attachment.bin>


More information about the libc-commits mailing list