[libc-commits] [libc] 96ff212 - [libc] Fix strspn
Alex Brachet via libc-commits
libc-commits at lists.llvm.org
Fri Mar 3 11:52:15 PST 2023
Author: Alex Brachet
Date: 2023-03-03T19:51:46Z
New Revision: 96ff21243eba3873e0da814baa9a7ff19b748b7c
URL: https://github.com/llvm/llvm-project/commit/96ff21243eba3873e0da814baa9a7ff19b748b7c
DIFF: https://github.com/llvm/llvm-project/commit/96ff21243eba3873e0da814baa9a7ff19b748b7c.diff
LOG: [libc] Fix strspn
Added:
Modified:
libc/src/string/strspn.cpp
Removed:
################################################################################
diff --git a/libc/src/string/strspn.cpp b/libc/src/string/strspn.cpp
index 60f16df8acb1e..9580d1bc403e8 100644
--- a/libc/src/string/strspn.cpp
+++ b/libc/src/string/strspn.cpp
@@ -19,8 +19,9 @@ LLVM_LIBC_FUNCTION(size_t, strspn, (const char *src, const char *segment)) {
cpp::bitset<256> bitset;
for (; *segment; ++segment)
- bitset.set(*segment);
- for (; *src && bitset.test(*src); ++src)
+ bitset.set(*reinterpret_cast<const unsigned char *>(segment));
+ for (; *src && bitset.test(*reinterpret_cast<const unsigned char *>(src));
+ ++src)
;
return src - initial;
}
More information about the libc-commits
mailing list