Skip to content

Commit 2adc753

Browse files
committed
fix overflow check
1 parent 5d84763 commit 2adc753

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/UTF8.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,10 +1476,10 @@ private unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust
14761476
contv += AdvSimd.CompareLessThanOrEqual(Vector128.AsSByte(currentBlock), largestcont);
14771477
n4v += AdvSimd.CompareGreaterThan(currentBlock, fourthByteMinusOne).AsSByte();
14781478
overflowCounter++;
1479-
// We have a risk of overflow if overflowCounter reaches 255,
1479+
// We have a risk of overflow if overflowCounter reaches 127,
14801480
// in which case, we empty contv and n4v, and update contbytes and
14811481
// n4.
1482-
if (overflowCounter == 0xff)
1482+
if (overflowCounter == 0x7f)
14831483
{
14841484
overflowCounter = 0;
14851485
contbytes += -AdvSimd.Arm64.AddAcrossWidening(contv).ToScalar();

0 commit comments

Comments
 (0)