@@ -598,7 +598,6 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust(
598
598
int asciibytes = 0 ; // number of ascii bytes in the block (could also be called n1)
599
599
int contbytes = 0 ; // number of continuation bytes in the block
600
600
int n4 = 0 ; // number of 4-byte sequences that start in this block
601
-
602
601
for ( ; processedLength + 32 <= inputLength ; processedLength += 32 )
603
602
{
604
603
@@ -661,16 +660,6 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust(
661
660
}
662
661
663
662
prevIncomplete = Avx2 . SubtractSaturate ( currentBlock , maxValue ) ;
664
-
665
- if ( ! Avx2 . TestZ ( prevIncomplete , prevIncomplete ) )
666
- {
667
- // We have an unterminated sequence.
668
- var ( totalbyteadjustment , i , tempascii , tempcont , tempn4 ) = adjustmentFactor ( pInputBuffer + processedLength + 32 ) ;
669
- processedLength -= i ;
670
- n4 += tempn4 ;
671
- contbytes += tempcont ;
672
- }
673
-
674
663
contbytes += ( int ) Popcnt . PopCount ( ( uint ) Avx2 . MoveMask ( byte_2_high ) ) ;
675
664
// We use two instructions (SubtractSaturate and MoveMask) to update n4, with one arithmetic operation.
676
665
n4 += ( int ) Popcnt . PopCount ( ( uint ) Avx2 . MoveMask ( Avx2 . SubtractSaturate ( currentBlock , fourthByte ) ) ) ;
@@ -681,7 +670,6 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust(
681
670
// and no expensive operation:
682
671
asciibytes += ( int ) ( 32 - Popcnt . PopCount ( ( uint ) mask ) ) ;
683
672
}
684
-
685
673
int totalbyte = processedLength - start_point ;
686
674
var ( utf16adjust , scalaradjust ) = CalculateN2N3FinalSIMDAdjustments ( asciibytes , n4 , contbytes , totalbyte ) ;
687
675
@@ -860,14 +848,6 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust(
860
848
return invalidBytePointer ;
861
849
}
862
850
prevIncomplete = AdvSimd . SubtractSaturate ( currentBlock , maxValue ) ;
863
- if ( AdvSimd . Arm64 . MaxAcross ( Vector128 . AsUInt32 ( prevIncomplete ) ) . ToScalar ( ) != 0 )
864
- {
865
- // We have an unterminated sequence.
866
- var ( totalbyteadjustment , i , tempascii , tempcont , tempn4 ) = adjustmentFactor ( pInputBuffer + processedLength + 32 ) ;
867
- processedLength -= i ;
868
- n4 += tempn4 ;
869
- contbytes += tempcont ;
870
- }
871
851
Vector128 < sbyte > largestcont = Vector128 . Create ( ( sbyte ) - 65 ) ; // -65 => 0b10111111
872
852
contbytes += 16 - AdvSimd . Arm64 . AddAcross ( AdvSimd . CompareGreaterThan ( Vector128 . AsSByte ( currentBlock ) , largestcont ) ) . ToScalar ( ) ;
873
853
Vector128 < byte > fourthByteMinusOne = Vector128 . Create ( ( byte ) ( 0b11110000u - 1 ) ) ;
0 commit comments