File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,10 @@ size_t strlen(const char *s) {
6666 const v128_t * w = (void * )(s - align );
6767
6868 while (true) {
69- if (!wasm_i8x16_all_true (* w )) {
70- int mask =
71- wasm_i8x16_bitmask (wasm_i8x16_eq (* w , (v128_t ){})) >> align << align ;
72- if (mask ) {
73- return (char * )w - s + __builtin_ctz (mask );
74- }
69+ const v128_t cmp = wasm_i8x16_eq (* w , (v128_t ){});
70+ if (wasm_v128_any_true (cmp )) {
71+ int mask = wasm_i8x16_bitmask (cmp ) >> align << align ;
72+ return (char * )w - s + __builtin_ctz (mask );
7573 }
7674 align = 0 ;
7775 w ++ ;
@@ -138,10 +136,9 @@ char *strchrnul(const char *s, int c) {
138136 const v128_t wc = wasm_i8x16_splat (c );
139137
140138 while (true) {
141- int mask = wasm_i8x16_bitmask (wasm_i8x16_eq (* w , (v128_t ){}) |
142- wasm_i8x16_eq (* w , wc )) >>
143- align << align ;
144- if (mask ) {
139+ const v128_t cmp = wasm_i8x16_eq (* w , (v128_t ){}) | wasm_i8x16_eq (* w , wc );
140+ if (wasm_v128_any_true (cmp )) {
141+ int mask = wasm_i8x16_bitmask (cmp ) >> align << align ;
145142 return (char * )w + __builtin_ctz (mask );
146143 }
147144 align = 0 ;
You can’t perform that action at this time.
0 commit comments