@@ -25,21 +25,21 @@ public static class UTF8
25
25
if ( foundLeadingBytes )
26
26
{
27
27
if ( i == 0 ) { break ; }
28
- Console . WriteLine ( "Found leading byte at:" + i + ",Byte:" + candidateByte . ToString ( "X2" ) ) ;
28
+ // Console.WriteLine("Found leading byte at:" + i + ",Byte:" + candidateByte.ToString("X2"));
29
29
// adjustment to avoid double counting
30
30
if ( ( candidateByte & 0b11100000 ) == 0b11000000 ) // Start of a 2-byte sequence
31
31
{
32
- Console . WriteLine ( "Found 2 byte" ) ;
32
+ // Console.WriteLine("Found 2 byte");
33
33
TempUtf16CodeUnitCountAdjustment += 1 ;
34
34
}
35
35
if ( ( candidateByte & 0b11110000 ) == 0b11100000 ) // Start of a 3-byte sequence
36
36
{
37
- Console . WriteLine ( "Found 3 byte" ) ;
37
+ // Console.WriteLine("Found 3 byte");
38
38
TempUtf16CodeUnitCountAdjustment += 2 ;
39
39
}
40
40
if ( ( candidateByte & 0b11111000 ) == 0b11110000 ) // Start of a 4-byte sequence
41
41
{
42
- Console . WriteLine ( "Found 4 byte" ) ;
42
+ // Console.WriteLine("Found 4 byte");
43
43
TempUtf16CodeUnitCountAdjustment += 2 ;
44
44
TempScalarCountAdjustment += 1 ;
45
45
}
@@ -79,11 +79,11 @@ public static class UTF8
79
79
utf16CodeUnitCountAdjustment += TailUtf16CodeUnitCountAdjustment ;
80
80
scalarCountAdjustment += TailScalarCountAdjustment ;
81
81
82
- Console . WriteLine ( "utf16count after rewint(Temp):" + TempUtf16CodeUnitCountAdjustment ) ;
83
- Console . WriteLine ( "scalarcount after rewint:" + TempScalarCountAdjustment ) ;
82
+ // Console.WriteLine("utf16count after rewint(Temp):" + TempUtf16CodeUnitCountAdjustment);
83
+ // Console.WriteLine("scalarcount after rewint:" + TempScalarCountAdjustment);
84
84
85
- Console . WriteLine ( "utf16count after rewint(Scalar):" + TailUtf16CodeUnitCountAdjustment ) ;
86
- Console . WriteLine ( "scalarcount after rewint:" + TailScalarCountAdjustment ) ;
85
+ // Console.WriteLine("utf16count after rewint(Scalar):" + TailUtf16CodeUnitCountAdjustment);
86
+ // Console.WriteLine("scalarcount after rewint:" + TailScalarCountAdjustment);
87
87
88
88
return invalidBytePointer ;
89
89
}
@@ -415,7 +415,7 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
415
415
416
416
public unsafe static byte * GetPointerToFirstInvalidByteAvx2 ( byte * pInputBuffer , int inputLength , out int utf16CodeUnitCountAdjustment , out int scalarCountAdjustment )
417
417
{
418
- Console . WriteLine ( "--------------------------Calling function----------------------------------" ) ;
418
+ // Console.WriteLine("--------------------------Calling function----------------------------------");
419
419
int processedLength = 0 ;
420
420
int TempUtf16CodeUnitCountAdjustment = 0 ;
421
421
int TempScalarCountAdjustment = 0 ;
@@ -568,7 +568,7 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
568
568
{
569
569
570
570
// TODO/think about : this path iss not explicitly tested
571
- Console . WriteLine ( "----Checkpoint 1:All ASCII need rewind" ) ;
571
+ // Console.WriteLine("----Checkpoint 1:All ASCII need rewind");
572
572
utf16CodeUnitCountAdjustment = TempUtf16CodeUnitCountAdjustment ;
573
573
scalarCountAdjustment = TempScalarCountAdjustment ;
574
574
@@ -648,17 +648,17 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
648
648
Vector256 < byte > error = Avx2 . Xor ( must23As80 , sc ) ;
649
649
if ( ! Avx2 . TestZ ( error , error ) ) //context: we are dealing with a 32 bit
650
650
{
651
- Console . WriteLine ( "-----Error path!!" ) ;
651
+ // Console.WriteLine("-----Error path!!");
652
652
TailScalarCodeUnitCountAdjustment = 0 ;
653
653
TailUtf16CodeUnitCountAdjustment = 0 ;
654
654
655
655
656
- int off = processedLength >= 32 ? processedLength : 0 ; // processedLength;
656
+ int off = processedLength >= 32 ? processedLength : processedLength ;
657
657
658
- Console . WriteLine ( "This is off :" + off ) ;
658
+ // Console.WriteLine("This is off :" + off);
659
659
// return SimdUnicode.UTF8.RewindAndValidateWithErrors(off, pInputBuffer + off, inputLength - off);
660
660
// byte* invalidBytePointer = SimdUnicode.UTF8.RewindAndValidateWithErrors(off, pInputBuffer + off, inputLength - off, ref utf16CodeUnitCountAdjustment,ref scalarCountAdjustment);
661
- byte * invalidBytePointer = SimdUnicode . UTF8 . RewindAndValidateWithErrors ( off , pInputBuffer + off , inputLength , ref TailUtf16CodeUnitCountAdjustment , ref TailScalarCodeUnitCountAdjustment ) ;
661
+ byte * invalidBytePointer = SimdUnicode . UTF8 . RewindAndValidateWithErrors ( off , pInputBuffer + off , inputLength - processedLength , ref TailUtf16CodeUnitCountAdjustment , ref TailScalarCodeUnitCountAdjustment ) ;
662
662
663
663
// byte* invalidBytePointer = SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar(pInputBuffer,processedLength,out TailUtf16CodeUnitCountAdjustment,out TailScalarCodeUnitCountAdjustment);
664
664
// Adjustments not to double count
@@ -688,7 +688,7 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
688
688
if ( ! Avx2 . TestZ ( prevIncomplete , prevIncomplete ) )
689
689
{
690
690
691
- Console . WriteLine ( "----Checkpoint 2:SIMD rewind" ) ;
691
+ // Console.WriteLine("----Checkpoint 2:SIMD rewind");
692
692
// We have an unterminated sequence.
693
693
processedLength -= 3 ;
694
694
for ( int k = 0 ; k < 3 ; k ++ )
@@ -721,7 +721,7 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
721
721
if ( processedLength < inputLength )
722
722
{
723
723
724
- Console . WriteLine ( "----Process remaining Scalar" ) ;
724
+ // Console.WriteLine("----Process remaining Scalar");
725
725
int overlapCount = 0 ;
726
726
727
727
// // We need to possibly backtrack to the start of the last code point
0 commit comments