Skip to content

Commit a01af70

Browse files
author
Sriya Pratipati
committed
simplified logic
1 parent ef10e8e commit a01af70

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

libc/src/wchar/wchar_utils.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ LIBC_INLINE bool internal_wcschr(wchar_t c, const wchar_t *str) {
2929
// To avoid duplicated code, call this with true for wcscspn and call with false
3030
// for wcsspn
3131
LIBC_INLINE size_t inline_wcsspn(const wchar_t *s1, const wchar_t *s2,
32-
bool invert) {
32+
bool match_set) {
3333
size_t i = 0;
3434
for (; s1[i]; ++i) {
35-
bool check = internal_wcschr(s1[i], s2);
36-
check = invert ? !check : check;
37-
if (!check)
35+
bool in_set = internal_wcschr(s1[i], s2);
36+
if (in_set == match_set)
3837
return i;
3938
}
4039
return i;

0 commit comments

Comments
 (0)