@@ -4,7 +4,9 @@ use std::simd::{
4
4
simd_swizzle, u8x16, LaneCount , Simd , SupportedLaneCount ,
5
5
} ;
6
6
7
- use crate :: { basic, compat, implementation:: helpers:: SIMD_CHUNK_SIZE } ;
7
+ use crate :: { basic, compat} ;
8
+
9
+ pub ( crate ) const SIMD_CHUNK_SIZE : usize = 64 ;
8
10
9
11
#[ cfg( all(
10
12
any( target_arch = "aarch64" , target_arch = "arm" ) ,
@@ -562,7 +564,6 @@ where
562
564
///
563
565
#[ inline]
564
566
pub fn validate_utf8_basic ( input : & [ u8 ] ) -> core:: result:: Result < ( ) , basic:: Utf8Error > {
565
- use crate :: implementation:: helpers:: SIMD_CHUNK_SIZE ;
566
567
let mut algorithm = Self :: new ( ) ;
567
568
let mut chunks = input. chunks_exact ( SIMD_CHUNK_SIZE ) ;
568
569
for chunk in chunks. by_ref ( ) {
@@ -593,7 +594,6 @@ where
593
594
#[ inline]
594
595
#[ expect( clippy:: redundant_else) ] // more readable
595
596
fn validate_utf8_compat_simd0 ( input : & [ u8 ] ) -> core:: result:: Result < ( ) , usize > {
596
- use crate :: implementation:: helpers:: SIMD_CHUNK_SIZE ;
597
597
let mut algorithm = Self :: new ( ) ;
598
598
let mut idx = 0 ;
599
599
let mut chunks = input. chunks_exact ( SIMD_CHUNK_SIZE ) ;
@@ -709,7 +709,6 @@ impl basic::imp::Utf8Validator for Utf8ValidatorImp {
709
709
710
710
#[ inline]
711
711
fn update ( & mut self , mut input : & [ u8 ] ) {
712
- use crate :: implementation:: helpers:: SIMD_CHUNK_SIZE ;
713
712
if input. is_empty ( ) {
714
713
return ;
715
714
}
@@ -779,8 +778,6 @@ impl basic::imp::ChunkedUtf8Validator for ChunkedUtf8ValidatorImp {
779
778
780
779
#[ inline]
781
780
fn update_from_chunks ( & mut self , input : & [ u8 ] ) {
782
- use crate :: implementation:: helpers:: SIMD_CHUNK_SIZE ;
783
-
784
781
assert ! (
785
782
input. len( ) % SIMD_CHUNK_SIZE == 0 ,
786
783
"Input size must be a multiple of 64."
@@ -796,8 +793,6 @@ impl basic::imp::ChunkedUtf8Validator for ChunkedUtf8ValidatorImp {
796
793
mut self ,
797
794
remaining_input : core:: option:: Option < & [ u8 ] > ,
798
795
) -> core:: result:: Result < ( ) , basic:: Utf8Error > {
799
- use crate :: implementation:: helpers:: SIMD_CHUNK_SIZE ;
800
-
801
796
if let Some ( mut remaining_input) = remaining_input {
802
797
if !remaining_input. is_empty ( ) {
803
798
let len = remaining_input. len ( ) ;
0 commit comments