File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -47,28 +47,23 @@ pub fn validate_unicode_scalar_sequence(seq: &[u32]) -> Option<&[char]> {
47
47
ptr = ptr_next;
48
48
}
49
49
50
- // still untested but it should work
51
50
#[ cfg( target_arch = "aarch64" ) ]
52
51
loop {
53
52
let ptr_next = ptr. add ( 4 ) ;
54
53
if ptr_next > ptr_end {
55
54
break ;
56
55
}
57
56
58
- let block = uint32x4_t :: load_unaligned ( ptr as * const u32 ) ;
57
+ let block = vld1q_u32 ( ptr as * const u32 ) ;
59
58
60
59
// check if has any character bigger than `char::MAX`
61
- if ( vqmovltq_u32 ( block, vdupq_n_u32 ( char:: MAX as u32 ) ) ) . any ( ) {
60
+ if vmaxvq_u32 ( block) >= char:: MAX as u32 {
62
61
return None ;
63
62
}
64
63
65
64
// check if has any high-surrogate and low-surrogate code points
66
- if !vandq_u32 (
67
- vcgtq_u32 ( block, vdupq_n_u32 ( 0xD7FF ) ) ,
68
- vcltq_u32 ( block, vdupq_n_u32 ( 0xE000 ) ) ,
69
- )
70
- . is_zero ( )
71
- {
65
+ // This is in the range `0xD800..0xE000`.
66
+ if vminvq_u32 ( vsubq_u32 ( block, vdupq_n_u32 ( 0xD800 ) ) ) < ( 0xE000 - 0xD800 ) {
72
67
return None ;
73
68
}
74
69
You can’t perform that action at this time.
0 commit comments