@@ -598,7 +598,6 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust(
598598 int asciibytes = 0 ; // number of ascii bytes in the block (could also be called n1)
599599 int contbytes = 0 ; // number of continuation bytes in the block
600600 int n4 = 0 ; // number of 4-byte sequences that start in this block
601-
602601 for ( ; processedLength + 32 <= inputLength ; processedLength += 32 )
603602 {
604603
@@ -661,16 +660,6 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust(
661660 }
662661
663662 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-
674663 contbytes += ( int ) Popcnt . PopCount ( ( uint ) Avx2 . MoveMask ( byte_2_high ) ) ;
675664 // We use two instructions (SubtractSaturate and MoveMask) to update n4, with one arithmetic operation.
676665 n4 += ( int ) Popcnt . PopCount ( ( uint ) Avx2 . MoveMask ( Avx2 . SubtractSaturate ( currentBlock , fourthByte ) ) ) ;
@@ -681,7 +670,6 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust(
681670 // and no expensive operation:
682671 asciibytes += ( int ) ( 32 - Popcnt . PopCount ( ( uint ) mask ) ) ;
683672 }
684-
685673 int totalbyte = processedLength - start_point ;
686674 var ( utf16adjust , scalaradjust ) = CalculateN2N3FinalSIMDAdjustments ( asciibytes , n4 , contbytes , totalbyte ) ;
687675
@@ -860,14 +848,6 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust(
860848 return invalidBytePointer ;
861849 }
862850 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- }
871851 Vector128 < sbyte > largestcont = Vector128 . Create ( ( sbyte ) - 65 ) ; // -65 => 0b10111111
872852 contbytes += 16 - AdvSimd . Arm64 . AddAcross ( AdvSimd . CompareGreaterThan ( Vector128 . AsSByte ( currentBlock ) , largestcont ) ) . ToScalar ( ) ;
873853 Vector128 < byte > fourthByteMinusOne = Vector128 . Create ( ( byte ) ( 0b11110000u - 1 ) ) ;
0 commit comments