@@ -325,7 +325,8 @@ type ParseStrFn = for<'invoke, 'de> unsafe fn(
325325 any( target_arch = "x86_64" , target_arch = "x86" ) ,
326326) ) ]
327327type FindStructuralBitsFn = unsafe fn (
328- input : & [ u8 ] ,
328+ input : & AlignedBuf ,
329+ len : usize ,
329330 structural_indexes : & mut Vec < u32 > ,
330331) -> std:: result:: Result < ( ) , ErrorType > ;
331332
@@ -597,7 +598,8 @@ impl<'de> Deserializer<'de> {
597598 any( target_arch = "x86_64" , target_arch = "x86" ) ,
598599 ) ) ]
599600 pub ( crate ) unsafe fn find_structural_bits (
600- input : & [ u8 ] ,
601+ input : & AlignedBuf ,
602+ len : usize ,
601603 structural_indexes : & mut Vec < u32 > ,
602604 ) -> std:: result:: Result < ( ) , ErrorType > {
603605 use std:: sync:: atomic:: { AtomicPtr , Ordering } ;
@@ -621,16 +623,17 @@ impl<'de> Deserializer<'de> {
621623
622624 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
623625 unsafe fn get_fastest (
624- input : & [ u8 ] ,
626+ input : & AlignedBuf ,
627+ len : usize ,
625628 structural_indexes : & mut Vec < u32 > ,
626629 ) -> core:: result:: Result < ( ) , error:: ErrorType > {
627630 let fun = get_fastest_available_implementation ( ) ;
628631 FN . store ( fun as FnRaw , Ordering :: Relaxed ) ;
629- ( fun) ( input, structural_indexes)
632+ ( fun) ( input, len , structural_indexes)
630633 }
631634
632635 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)
634637 }
635638
636639 #[ cfg( not( any(
@@ -646,7 +649,8 @@ impl<'de> Deserializer<'de> {
646649 ) ) ) ]
647650 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
648651 pub ( crate ) unsafe fn find_structural_bits (
649- input : & [ u8 ] ,
652+ input : & AlignedBuf ,
653+ len : usize ,
650654 structural_indexes : & mut Vec < u32 > ,
651655 ) -> std:: result:: Result < ( ) , ErrorType > {
652656 // This is a nasty hack, we don't have a chunked implementation for native rust
@@ -656,16 +660,17 @@ impl<'de> Deserializer<'de> {
656660 Err ( _) => return Err ( ErrorType :: InvalidUtf8 ) ,
657661 } ;
658662 #[ 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)
660664 }
661665
662666 #[ cfg( all( feature = "portable" , not( feature = "runtime-detection" ) ) ) ]
663667 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
664668 pub ( crate ) unsafe fn find_structural_bits (
665- input : & [ u8 ] ,
669+ input : & AlignedBuf ,
670+ len : usize ,
666671 structural_indexes : & mut Vec < u32 > ,
667672 ) -> 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)
669674 }
670675
671676 #[ cfg( all(
@@ -675,10 +680,11 @@ impl<'de> Deserializer<'de> {
675680 ) ) ]
676681 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
677682 pub ( crate ) unsafe fn find_structural_bits (
678- input : & [ u8 ] ,
683+ input : & AlignedBuf ,
684+ len : usize ,
679685 structural_indexes : & mut Vec < u32 > ,
680686 ) -> 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)
682688 }
683689
684690 #[ cfg( all(
@@ -689,10 +695,11 @@ impl<'de> Deserializer<'de> {
689695 ) ) ]
690696 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
691697 pub ( crate ) unsafe fn find_structural_bits (
692- input : & [ u8 ] ,
698+ input : & AlignedBuf ,
699+ len : usize ,
693700 structural_indexes : & mut Vec < u32 > ,
694701 ) -> 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)
696703 }
697704
698705 #[ cfg( all( target_arch = "aarch64" , not( feature = "portable" ) ) ) ]
@@ -708,10 +715,11 @@ impl<'de> Deserializer<'de> {
708715 #[ cfg( all( target_feature = "simd128" , not( feature = "portable" ) ) ) ]
709716 #[ cfg_attr( not( feature = "no-inline" ) , inline) ]
710717 pub ( crate ) unsafe fn find_structural_bits (
711- input : & [ u8 ] ,
718+ input : & AlignedBuf ,
719+ len : usize ,
712720 structural_indexes : & mut Vec < u32 > ,
713721 ) -> 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)
715723 }
716724}
717725
0 commit comments