@@ -426,7 +426,8 @@ type ParseStrFn = for<'invoke, 'de> unsafe fn(
426426 any( target_arch = "x86_64" , target_arch = "x86" ) ,
427427) ) ]
428428type FindStructuralBitsFn = unsafe fn (
429- input : & [ u8 ] ,
429+ input : & AlignedBuf ,
430+ len : usize ,
430431 structural_indexes : & mut Vec < u32 > ,
431432) -> std:: result:: Result < ( ) , ErrorType > ;
432433
@@ -698,7 +699,8 @@ impl<'de> Deserializer<'de> {
698699 any( target_arch = "x86_64" , target_arch = "x86" ) ,
699700 ) ) ]
700701 pub ( crate ) unsafe fn find_structural_bits (
701- input : & [ u8 ] ,
702+ input : & AlignedBuf ,
703+ len : usize ,
702704 structural_indexes : & mut Vec < u32 > ,
703705 ) -> std:: result:: Result < ( ) , ErrorType > {
704706 use std:: sync:: atomic:: { AtomicPtr , Ordering } ;
@@ -722,16 +724,17 @@ impl<'de> Deserializer<'de> {
722724
723725 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
724726 unsafe fn get_fastest (
725- input : & [ u8 ] ,
727+ input : & AlignedBuf ,
728+ len : usize ,
726729 structural_indexes : & mut Vec < u32 > ,
727730 ) -> core:: result:: Result < ( ) , error:: ErrorType > {
728731 let fun = get_fastest_available_implementation ( ) ;
729732 FN . store ( fun as FnRaw , Ordering :: Relaxed ) ;
730- ( fun) ( input, structural_indexes)
733+ ( fun) ( input, len , structural_indexes)
731734 }
732735
733736 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)
735738 }
736739
737740 #[ cfg( not( any(
@@ -747,7 +750,8 @@ impl<'de> Deserializer<'de> {
747750 ) ) ) ]
748751 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
749752 pub ( crate ) unsafe fn find_structural_bits (
750- input : & [ u8 ] ,
753+ input : & AlignedBuf ,
754+ len : usize ,
751755 structural_indexes : & mut Vec < u32 > ,
752756 ) -> std:: result:: Result < ( ) , ErrorType > {
753757 // This is a nasty hack, we don't have a chunked implementation for native rust
@@ -757,16 +761,17 @@ impl<'de> Deserializer<'de> {
757761 Err ( _) => return Err ( ErrorType :: InvalidUtf8 ) ,
758762 } ;
759763 #[ 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)
761765 }
762766
763767 #[ cfg( all( feature = "portable" , not( feature = "runtime-detection" ) ) ) ]
764768 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
765769 pub ( crate ) unsafe fn find_structural_bits (
766- input : & [ u8 ] ,
770+ input : & AlignedBuf ,
771+ len : usize ,
767772 structural_indexes : & mut Vec < u32 > ,
768773 ) -> 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)
770775 }
771776
772777 #[ cfg( all(
@@ -776,10 +781,11 @@ impl<'de> Deserializer<'de> {
776781 ) ) ]
777782 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
778783 pub ( crate ) unsafe fn find_structural_bits (
779- input : & [ u8 ] ,
784+ input : & AlignedBuf ,
785+ len : usize ,
780786 structural_indexes : & mut Vec < u32 > ,
781787 ) -> 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)
783789 }
784790
785791 #[ cfg( all(
@@ -790,10 +796,11 @@ impl<'de> Deserializer<'de> {
790796 ) ) ]
791797 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
792798 pub ( crate ) unsafe fn find_structural_bits (
793- input : & [ u8 ] ,
799+ input : & AlignedBuf ,
800+ len : usize ,
794801 structural_indexes : & mut Vec < u32 > ,
795802 ) -> 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)
797804 }
798805
799806 #[ cfg( all( target_arch = "aarch64" , not( feature = "portable" ) ) ) ]
@@ -809,10 +816,11 @@ impl<'de> Deserializer<'de> {
809816 #[ cfg( all( target_feature = "simd128" , not( feature = "portable" ) ) ) ]
810817 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
811818 pub ( crate ) unsafe fn find_structural_bits (
812- input : & [ u8 ] ,
819+ input : & AlignedBuf ,
820+ len : usize ,
813821 structural_indexes : & mut Vec < u32 > ,
814822 ) -> 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)
816824 }
817825}
818826
0 commit comments