File tree 2 files changed +3
-8
lines changed
2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -453,22 +453,17 @@ impl<'a> SliceRead<'a> {
453
453
const ONE_BYTES : Chunk = Chunk :: MAX / 255 ; // 0x0101...01
454
454
455
455
for chunk in rest. chunks_exact ( STEP ) {
456
- let chars = Chunk :: from_ne_bytes ( chunk. try_into ( ) . unwrap ( ) ) ;
456
+ let chars = Chunk :: from_le_bytes ( chunk. try_into ( ) . unwrap ( ) ) ;
457
457
let contains_ctrl = chars. wrapping_sub ( ONE_BYTES * 0x20 ) & !chars;
458
458
let chars_quote = chars ^ ( ONE_BYTES * Chunk :: from ( b'"' ) ) ;
459
459
let contains_quote = chars_quote. wrapping_sub ( ONE_BYTES ) & !chars_quote;
460
460
let chars_backslash = chars ^ ( ONE_BYTES * Chunk :: from ( b'\\' ) ) ;
461
461
let contains_backslash = chars_backslash. wrapping_sub ( ONE_BYTES ) & !chars_backslash;
462
462
let masked = ( contains_ctrl | contains_quote | contains_backslash) & ( ONE_BYTES << 7 ) ;
463
463
if masked != 0 {
464
- let addresswise_first_bit = if cfg ! ( target_endian = "little" ) {
465
- masked. trailing_zeros ( )
466
- } else {
467
- masked. leading_zeros ( )
468
- } ;
469
464
// SAFETY: chunk is in-bounds for slice
470
465
self . index = unsafe { chunk. as_ptr ( ) . offset_from ( self . slice . as_ptr ( ) ) } as usize
471
- + addresswise_first_bit as usize / 8 ;
466
+ + masked . trailing_zeros ( ) as usize / 8 ;
472
467
return ;
473
468
}
474
469
}
Original file line number Diff line number Diff line change @@ -2504,7 +2504,7 @@ fn test_control_character_search() {
2504
2504
for n in 0 ..16 {
2505
2505
for m in 0 ..16 {
2506
2506
test_parse_err :: < String > ( & [ (
2507
- & format ! ( "\" {}\n {}\" " , ". " . repeat( n) , ". " . repeat( m) ) ,
2507
+ & format ! ( "\" {}\n {}\" " , " " . repeat( n) , " " . repeat( m) ) ,
2508
2508
"control character (\\ u0000-\\ u001F) found while parsing a string at line 2 column 0" ,
2509
2509
) ] ) ;
2510
2510
}
You can’t perform that action at this time.
0 commit comments