@@ -36,12 +36,6 @@ impl Utf8CheckingState<__m128i> {
3636 _mm_or_si128 ( a, b)
3737 }
3838
39- #[ target_feature( enable = "sse4.2" ) ]
40- #[ inline]
41- unsafe fn is_ascii ( input : __m128i ) -> bool {
42- _mm_movemask_epi8 ( input) == 0
43- }
44-
4539 #[ target_feature( enable = "sse4.2" ) ]
4640 #[ inline]
4741 unsafe fn check_eof ( error : __m128i , incomplete : __m128i ) -> __m128i {
@@ -205,8 +199,6 @@ impl Utf8CheckingState<__m128i> {
205199 _mm_testz_si128 ( error, error) != 1
206200 }
207201
208- #[ target_feature( enable = "sse4.2" ) ]
209- #[ inline]
210202 check_bytes ! ( "sse4.2" , __m128i) ;
211203}
212204
@@ -239,13 +231,22 @@ impl SimdInput {
239231
240232 #[ target_feature( enable = "sse4.2" ) ]
241233 #[ inline]
242- unsafe fn check_utf8 ( & self , state : & mut Utf8CheckingState < __m128i > ) {
234+ unsafe fn check_block ( & self , state : & mut Utf8CheckingState < __m128i > ) {
243235 Utf8CheckingState :: < __m128i > :: check_bytes ( self . v0 , state) ;
244236 Utf8CheckingState :: < __m128i > :: check_bytes ( self . v1 , state) ;
245237 Utf8CheckingState :: < __m128i > :: check_bytes ( self . v2 , state) ;
246238 Utf8CheckingState :: < __m128i > :: check_bytes ( self . v3 , state) ;
247239 }
248240
241+ #[ target_feature( enable = "sse4.2" ) ]
242+ #[ inline]
243+ unsafe fn is_ascii ( & self ) -> bool {
244+ let r1 = _mm_or_si128 ( self . v0 , self . v1 ) ;
245+ let r2 = _mm_or_si128 ( self . v2 , self . v3 ) ;
246+ let r = _mm_or_si128 ( r1, r2) ;
247+ _mm_movemask_epi8 ( r) == 0
248+ }
249+
249250 #[ target_feature( enable = "sse4.2" ) ]
250251 #[ inline]
251252 unsafe fn check_eof ( state : & mut Utf8CheckingState < __m128i > ) {
@@ -257,6 +258,8 @@ impl SimdInput {
257258 unsafe fn check_utf8_errors ( state : & Utf8CheckingState < __m128i > ) -> bool {
258259 Utf8CheckingState :: < __m128i > :: has_error ( state. error )
259260 }
261+
262+ check_utf8 ! ( "sse4.2" , __m128i) ;
260263}
261264
262265use crate :: implementation:: Temp2x64A16 ;
0 commit comments