@@ -426,7 +426,8 @@ type ParseStrFn = for<'invoke, 'de> unsafe fn(
426
426
any( target_arch = "x86_64" , target_arch = "x86" ) ,
427
427
) ) ]
428
428
type FindStructuralBitsFn = unsafe fn (
429
- input : & [ u8 ] ,
429
+ input : & AlignedBuf ,
430
+ len : usize ,
430
431
structural_indexes : & mut Vec < u32 > ,
431
432
) -> std:: result:: Result < ( ) , ErrorType > ;
432
433
@@ -698,7 +699,8 @@ impl<'de> Deserializer<'de> {
698
699
any( target_arch = "x86_64" , target_arch = "x86" ) ,
699
700
) ) ]
700
701
pub ( crate ) unsafe fn find_structural_bits (
701
- input : & [ u8 ] ,
702
+ input : & AlignedBuf ,
703
+ len : usize ,
702
704
structural_indexes : & mut Vec < u32 > ,
703
705
) -> std:: result:: Result < ( ) , ErrorType > {
704
706
use std:: sync:: atomic:: { AtomicPtr , Ordering } ;
@@ -722,16 +724,17 @@ impl<'de> Deserializer<'de> {
722
724
723
725
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
724
726
unsafe fn get_fastest (
725
- input : & [ u8 ] ,
727
+ input : & AlignedBuf ,
728
+ len : usize ,
726
729
structural_indexes : & mut Vec < u32 > ,
727
730
) -> core:: result:: Result < ( ) , error:: ErrorType > {
728
731
let fun = get_fastest_available_implementation ( ) ;
729
732
FN . store ( fun as FnRaw , Ordering :: Relaxed ) ;
730
- ( fun) ( input, structural_indexes)
733
+ ( fun) ( input, len , structural_indexes)
731
734
}
732
735
733
736
let fun = FN . load ( Ordering :: Relaxed ) ;
734
- mem:: transmute :: < FnRaw , FindStructuralBitsFn > ( fun) ( input, structural_indexes)
737
+ mem:: transmute :: < FnRaw , FindStructuralBitsFn > ( fun) ( input, len , structural_indexes)
735
738
}
736
739
737
740
#[ cfg( not( any(
@@ -747,7 +750,8 @@ impl<'de> Deserializer<'de> {
747
750
) ) ) ]
748
751
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
749
752
pub ( crate ) unsafe fn find_structural_bits (
750
- input : & [ u8 ] ,
753
+ input : & AlignedBuf ,
754
+ len : usize ,
751
755
structural_indexes : & mut Vec < u32 > ,
752
756
) -> std:: result:: Result < ( ) , ErrorType > {
753
757
// This is a nasty hack, we don't have a chunked implementation for native rust
@@ -757,16 +761,17 @@ impl<'de> Deserializer<'de> {
757
761
Err ( _) => return Err ( ErrorType :: InvalidUtf8 ) ,
758
762
} ;
759
763
#[ cfg( not( feature = "portable" ) ) ]
760
- Self :: _find_structural_bits :: < impls:: native:: SimdInput > ( input, structural_indexes)
764
+ Self :: _find_structural_bits :: < impls:: native:: SimdInput > ( input, len , structural_indexes)
761
765
}
762
766
763
767
#[ cfg( all( feature = "portable" , not( feature = "runtime-detection" ) ) ) ]
764
768
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
765
769
pub ( crate ) unsafe fn find_structural_bits (
766
- input : & [ u8 ] ,
770
+ input : & AlignedBuf ,
771
+ len : usize ,
767
772
structural_indexes : & mut Vec < u32 > ,
768
773
) -> std:: result:: Result < ( ) , ErrorType > {
769
- Self :: _find_structural_bits :: < impls:: portable:: SimdInput > ( input, structural_indexes)
774
+ Self :: _find_structural_bits :: < impls:: portable:: SimdInput > ( input, len , structural_indexes)
770
775
}
771
776
772
777
#[ cfg( all(
@@ -776,10 +781,11 @@ impl<'de> Deserializer<'de> {
776
781
) ) ]
777
782
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
778
783
pub ( crate ) unsafe fn find_structural_bits (
779
- input : & [ u8 ] ,
784
+ input : & AlignedBuf ,
785
+ len : usize ,
780
786
structural_indexes : & mut Vec < u32 > ,
781
787
) -> std:: result:: Result < ( ) , ErrorType > {
782
- Self :: _find_structural_bits :: < impls:: avx2:: SimdInput > ( input, structural_indexes)
788
+ Self :: _find_structural_bits :: < impls:: avx2:: SimdInput > ( input, len , structural_indexes)
783
789
}
784
790
785
791
#[ cfg( all(
@@ -790,10 +796,11 @@ impl<'de> Deserializer<'de> {
790
796
) ) ]
791
797
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
792
798
pub ( crate ) unsafe fn find_structural_bits (
793
- input : & [ u8 ] ,
799
+ input : & AlignedBuf ,
800
+ len : usize ,
794
801
structural_indexes : & mut Vec < u32 > ,
795
802
) -> std:: result:: Result < ( ) , ErrorType > {
796
- Self :: _find_structural_bits :: < impls:: sse42:: SimdInput > ( input, structural_indexes)
803
+ Self :: _find_structural_bits :: < impls:: sse42:: SimdInput > ( input, len , structural_indexes)
797
804
}
798
805
799
806
#[ cfg( all( target_arch = "aarch64" , not( feature = "portable" ) ) ) ]
@@ -809,10 +816,11 @@ impl<'de> Deserializer<'de> {
809
816
#[ cfg( all( target_feature = "simd128" , not( feature = "portable" ) ) ) ]
810
817
#[ cfg_attr( not( feature = "no-inline" ) , inline) ]
811
818
pub ( crate ) unsafe fn find_structural_bits (
812
- input : & [ u8 ] ,
819
+ input : & AlignedBuf ,
820
+ len : usize ,
813
821
structural_indexes : & mut Vec < u32 > ,
814
822
) -> std:: result:: Result < ( ) , ErrorType > {
815
- Self :: _find_structural_bits :: < impls:: simd128:: SimdInput > ( input, structural_indexes)
823
+ Self :: _find_structural_bits :: < impls:: simd128:: SimdInput > ( input, len , structural_indexes)
816
824
}
817
825
}
818
826
0 commit comments