@@ -9,24 +9,13 @@ pub use crate::neon::utf8check::*;
9
9
pub use crate :: stringparse:: * ;
10
10
11
11
pub use crate :: neon:: intrinsics:: * ;
12
- use std:: io:: Write ;
13
12
14
- unsafe fn find_bs_bits_and_quote_bits ( src : & [ u8 ] , dstx : Option < & mut [ u8 ] > ) -> ParseStringHelper {
13
+ unsafe fn find_bs_bits_and_quote_bits ( src : & [ u8 ] ) -> ParseStringHelper {
15
14
// this can read up to 31 bytes beyond the buffer size, but we require
16
15
// SIMDJSON_PADDING of padding
17
16
let v0 : uint8x16_t = vld1q_u8 ( src. as_ptr ( ) ) ;
18
17
let v1 : uint8x16_t = vld1q_u8 ( src. as_ptr ( ) . add ( 16 ) ) ;
19
18
20
- match dstx {
21
- Some ( mut dst) => {
22
- // vst1q_u8(dst.as_mut_ptr(), v0);
23
- // vst1q_u8(dst.as_mut_ptr().add(16), v1);
24
- dst. write ( & src[ 0 ..16 ] ) . unwrap ( ) ;
25
- dst. write ( & src[ 16 ..32 ] ) . unwrap ( ) ;
26
- } ,
27
- _ => ( )
28
- }
29
-
30
19
let bs_mask : uint8x16_t = vmovq_n_u8 ( '\\' as u8 ) ;
31
20
let qt_mask : uint8x16_t = vmovq_n_u8 ( '"' as u8 ) ;
32
21
@@ -84,7 +73,7 @@ impl<'de> Deserializer<'de> {
84
73
}
85
74
} ;
86
75
87
- let ParseStringHelper { bs_bits, quote_bits } = unsafe { find_bs_bits_and_quote_bits ( & srcx, None ) } ;
76
+ let ParseStringHelper { bs_bits, quote_bits } = unsafe { find_bs_bits_and_quote_bits ( & srcx) } ;
88
77
89
78
if ( bs_bits. wrapping_sub ( 1 ) & quote_bits) != 0 {
90
79
// we encountered quotes first. Move dst to point to quotes and exit
@@ -123,7 +112,7 @@ impl<'de> Deserializer<'de> {
123
112
}
124
113
125
114
let mut dst_i: usize = 0 ;
126
- let dst: & mut [ u8 ] = & mut self . strings ;
115
+ let dst: & mut [ u8 ] = self . strings . as_mut_slice ( ) ;
127
116
128
117
loop {
129
118
let srcx = if src. len ( ) >= src_i + 32 {
@@ -137,9 +126,11 @@ impl<'de> Deserializer<'de> {
137
126
}
138
127
} ;
139
128
129
+ dst[ dst_i..dst_i + 32 ] . copy_from_slice ( & srcx[ ..32 ] ) ;
130
+
140
131
// store to dest unconditionally - we can overwrite the bits we don't like
141
132
// later
142
- let ParseStringHelper { bs_bits, quote_bits } = unsafe { find_bs_bits_and_quote_bits ( & srcx, Some ( dst ) ) } ;
133
+ let ParseStringHelper { bs_bits, quote_bits } = unsafe { find_bs_bits_and_quote_bits ( & srcx) } ;
143
134
144
135
if ( bs_bits. wrapping_sub ( 1 ) & quote_bits) != 0 {
145
136
// we encountered quotes first. Move dst to point to quotes and exit
0 commit comments