Skip to content

Commit ee69434

Browse files
committed
Test ARM strlen.
1 parent 5908a9e commit ee69434

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sqlite3/strings.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ size_t strlen(const char *s) {
6666
const v128_t *w = (void *)(s - align);
6767

6868
while (true) {
69-
const v128_t cmp = wasm_i8x16_eq(*w, (v128_t){});
70-
if (wasm_v128_any_true(cmp)) {
69+
if (!wasm_i8x16_all_true(*w)) {
70+
const v128_t cmp = wasm_i8x16_eq(*w, (v128_t){});
7171
int mask = wasm_i8x16_bitmask(cmp) >> align << align;
7272
return (char *)w - s + __builtin_ctz(mask);
7373
}
@@ -158,6 +158,8 @@ char *strchr(const char *s, int c) {
158158
<< ((b) % (8 * sizeof(size_t))))
159159

160160
size_t strspn(const char *s, const char *c) {
161+
if (!c[0]) return 0;
162+
161163
const char *const a = s;
162164
size_t byteset[32 / sizeof(size_t)] = {0};
163165

0 commit comments

Comments
 (0)