Skip to content

Commit b5445bb

Browse files
committed
save game
1 parent 006738c commit b5445bb

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/UTF8.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ public static class UTF8
2525
if (foundLeadingBytes)
2626
{
2727
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"));
2929
// adjustment to avoid double counting
3030
if ((candidateByte & 0b11100000) == 0b11000000) // Start of a 2-byte sequence
3131
{
32-
Console.WriteLine("Found 2 byte");
32+
// Console.WriteLine("Found 2 byte");
3333
TempUtf16CodeUnitCountAdjustment += 1;
3434
}
3535
if ((candidateByte & 0b11110000) == 0b11100000) // Start of a 3-byte sequence
3636
{
37-
Console.WriteLine("Found 3 byte");
37+
// Console.WriteLine("Found 3 byte");
3838
TempUtf16CodeUnitCountAdjustment += 2;
3939
}
4040
if ((candidateByte & 0b11111000) == 0b11110000) // Start of a 4-byte sequence
4141
{
42-
Console.WriteLine("Found 4 byte");
42+
// Console.WriteLine("Found 4 byte");
4343
TempUtf16CodeUnitCountAdjustment += 2;
4444
TempScalarCountAdjustment += 1;
4545
}
@@ -79,11 +79,11 @@ public static class UTF8
7979
utf16CodeUnitCountAdjustment += TailUtf16CodeUnitCountAdjustment;
8080
scalarCountAdjustment += TailScalarCountAdjustment;
8181

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);
8484

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);
8787

8888
return invalidBytePointer;
8989
}
@@ -415,7 +415,7 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
415415

416416
public unsafe static byte* GetPointerToFirstInvalidByteAvx2(byte* pInputBuffer, int inputLength,out int utf16CodeUnitCountAdjustment, out int scalarCountAdjustment)
417417
{
418-
Console.WriteLine("--------------------------Calling function----------------------------------");
418+
// Console.WriteLine("--------------------------Calling function----------------------------------");
419419
int processedLength = 0;
420420
int TempUtf16CodeUnitCountAdjustment= 0 ;
421421
int TempScalarCountAdjustment = 0;
@@ -568,7 +568,7 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
568568
{
569569

570570
// 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");
572572
utf16CodeUnitCountAdjustment = TempUtf16CodeUnitCountAdjustment;
573573
scalarCountAdjustment = TempScalarCountAdjustment;
574574

@@ -648,17 +648,17 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
648648
Vector256<byte> error = Avx2.Xor(must23As80, sc);
649649
if (!Avx2.TestZ(error, error)) //context: we are dealing with a 32 bit
650650
{
651-
Console.WriteLine("-----Error path!!");
651+
// Console.WriteLine("-----Error path!!");
652652
TailScalarCodeUnitCountAdjustment =0;
653653
TailUtf16CodeUnitCountAdjustment =0;
654654

655655

656-
int off = processedLength >= 32 ? processedLength : 0;//processedLength;
656+
int off = processedLength >= 32 ? processedLength : processedLength;
657657

658-
Console.WriteLine("This is off :" + off);
658+
// Console.WriteLine("This is off :" + off);
659659
// return SimdUnicode.UTF8.RewindAndValidateWithErrors(off, pInputBuffer + off, inputLength - off);
660660
// 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);
662662

663663
// byte* invalidBytePointer = SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar(pInputBuffer,processedLength,out TailUtf16CodeUnitCountAdjustment,out TailScalarCodeUnitCountAdjustment);
664664
// Adjustments not to double count
@@ -688,7 +688,7 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
688688
if (!Avx2.TestZ(prevIncomplete, prevIncomplete))
689689
{
690690

691-
Console.WriteLine("----Checkpoint 2:SIMD rewind");
691+
// Console.WriteLine("----Checkpoint 2:SIMD rewind");
692692
// We have an unterminated sequence.
693693
processedLength -= 3;
694694
for(int k = 0; k < 3; k++)
@@ -721,7 +721,7 @@ public unsafe static void AdjustForSkippedBytes(byte* pInputBuffer,// int skippe
721721
if (processedLength < inputLength)
722722
{
723723

724-
Console.WriteLine("----Process remaining Scalar");
724+
// Console.WriteLine("----Process remaining Scalar");
725725
int overlapCount = 0;
726726

727727
// // We need to possibly backtrack to the start of the last code point

0 commit comments

Comments
 (0)