@@ -325,7 +325,8 @@ type ParseStrFn = for<'invoke, 'de> unsafe fn(
325
325
any( target_arch = "x86_64" , target_arch = "x86" ) ,
326
326
) ) ]
327
327
type FindStructuralBitsFn = unsafe fn (
328
- input : & [ u8 ] ,
328
+ input : & AlignedBuf ,
329
+ len : usize ,
329
330
structural_indexes : & mut Vec < u32 > ,
330
331
) -> std:: result:: Result < ( ) , ErrorType > ;
331
332
@@ -597,7 +598,8 @@ impl<'de> Deserializer<'de> {
597
598
any( target_arch = "x86_64" , target_arch = "x86" ) ,
598
599
) ) ]
599
600
pub ( crate ) unsafe fn find_structural_bits (
600
- input : & [ u8 ] ,
601
+ input : & AlignedBuf ,
602
+ len : usize ,
601
603
structural_indexes : & mut Vec < u32 > ,
602
604
) -> std:: result:: Result < ( ) , ErrorType > {
603
605
use std:: sync:: atomic:: { AtomicPtr , Ordering } ;
@@ -621,16 +623,17 @@ impl<'de> Deserializer<'de> {
621
623
622
624
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
623
625
unsafe fn get_fastest (
624
- input : & [ u8 ] ,
626
+ input : & AlignedBuf ,
627
+ len : usize ,
625
628
structural_indexes : & mut Vec < u32 > ,
626
629
) -> core:: result:: Result < ( ) , error:: ErrorType > {
627
630
let fun = get_fastest_available_implementation ( ) ;
628
631
FN . store ( fun as FnRaw , Ordering :: Relaxed ) ;
629
- ( fun) ( input, structural_indexes)
632
+ ( fun) ( input, len , structural_indexes)
630
633
}
631
634
632
635
let fun = FN . load ( Ordering :: Relaxed ) ;
633
- mem:: transmute :: < FnRaw , FindStructuralBitsFn > ( fun) ( input, structural_indexes)
636
+ mem:: transmute :: < FnRaw , FindStructuralBitsFn > ( fun) ( input, len , structural_indexes)
634
637
}
635
638
636
639
#[ cfg( not( any(
@@ -646,7 +649,8 @@ impl<'de> Deserializer<'de> {
646
649
) ) ) ]
647
650
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
648
651
pub ( crate ) unsafe fn find_structural_bits (
649
- input : & [ u8 ] ,
652
+ input : & AlignedBuf ,
653
+ len : usize ,
650
654
structural_indexes : & mut Vec < u32 > ,
651
655
) -> std:: result:: Result < ( ) , ErrorType > {
652
656
// This is a nasty hack, we don't have a chunked implementation for native rust
@@ -656,16 +660,17 @@ impl<'de> Deserializer<'de> {
656
660
Err ( _) => return Err ( ErrorType :: InvalidUtf8 ) ,
657
661
} ;
658
662
#[ cfg( not( feature = "portable" ) ) ]
659
- Self :: _find_structural_bits :: < impls:: native:: SimdInput > ( input, structural_indexes)
663
+ Self :: _find_structural_bits :: < impls:: native:: SimdInput > ( input, len , structural_indexes)
660
664
}
661
665
662
666
#[ cfg( all( feature = "portable" , not( feature = "runtime-detection" ) ) ) ]
663
667
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
664
668
pub ( crate ) unsafe fn find_structural_bits (
665
- input : & [ u8 ] ,
669
+ input : & AlignedBuf ,
670
+ len : usize ,
666
671
structural_indexes : & mut Vec < u32 > ,
667
672
) -> std:: result:: Result < ( ) , ErrorType > {
668
- Self :: _find_structural_bits :: < impls:: portable:: SimdInput > ( input, structural_indexes)
673
+ Self :: _find_structural_bits :: < impls:: portable:: SimdInput > ( input, len , structural_indexes)
669
674
}
670
675
671
676
#[ cfg( all(
@@ -675,10 +680,11 @@ impl<'de> Deserializer<'de> {
675
680
) ) ]
676
681
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
677
682
pub ( crate ) unsafe fn find_structural_bits (
678
- input : & [ u8 ] ,
683
+ input : & AlignedBuf ,
684
+ len : usize ,
679
685
structural_indexes : & mut Vec < u32 > ,
680
686
) -> std:: result:: Result < ( ) , ErrorType > {
681
- Self :: _find_structural_bits :: < impls:: avx2:: SimdInput > ( input, structural_indexes)
687
+ Self :: _find_structural_bits :: < impls:: avx2:: SimdInput > ( input, len , structural_indexes)
682
688
}
683
689
684
690
#[ cfg( all(
@@ -689,10 +695,11 @@ impl<'de> Deserializer<'de> {
689
695
) ) ]
690
696
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
691
697
pub ( crate ) unsafe fn find_structural_bits (
692
- input : & [ u8 ] ,
698
+ input : & AlignedBuf ,
699
+ len : usize ,
693
700
structural_indexes : & mut Vec < u32 > ,
694
701
) -> std:: result:: Result < ( ) , ErrorType > {
695
- Self :: _find_structural_bits :: < impls:: sse42:: SimdInput > ( input, structural_indexes)
702
+ Self :: _find_structural_bits :: < impls:: sse42:: SimdInput > ( input, len , structural_indexes)
696
703
}
697
704
698
705
#[ cfg( all( target_arch = "aarch64" , not( feature = "portable" ) ) ) ]
@@ -708,10 +715,11 @@ impl<'de> Deserializer<'de> {
708
715
#[ cfg( all( target_feature = "simd128" , not( feature = "portable" ) ) ) ]
709
716
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
710
717
pub ( crate ) unsafe fn find_structural_bits (
711
- input : & [ u8 ] ,
718
+ input : & AlignedBuf ,
719
+ len : usize ,
712
720
structural_indexes : & mut Vec < u32 > ,
713
721
) -> std:: result:: Result < ( ) , ErrorType > {
714
- Self :: _find_structural_bits :: < impls:: simd128:: SimdInput > ( input, structural_indexes)
722
+ Self :: _find_structural_bits :: < impls:: simd128:: SimdInput > ( input, len , structural_indexes)
715
723
}
716
724
}
717
725
0 commit comments