Skip to content

Commit 9fd2b33

Browse files
committed
simplify arm code
1 parent 7f3246e commit 9fd2b33

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/UTF8.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,14 +1390,10 @@ private unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust
13901390
int localasciirun = 16;
13911391
if (processedLength + localasciirun + 64 <= inputLength)
13921392
{
1393-
for (; processedLength + localasciirun + 64 <= inputLength; localasciirun += 64)
1393+
for (; processedLength + localasciirun + 16 <= inputLength; localasciirun += 16)
13941394
{
1395-
Vector128<byte> block1 = AdvSimd.LoadVector128(pInputBuffer + processedLength + localasciirun);
1396-
Vector128<byte> block2 = AdvSimd.LoadVector128(pInputBuffer + processedLength + localasciirun + 16);
1397-
Vector128<byte> block3 = AdvSimd.LoadVector128(pInputBuffer + processedLength + localasciirun + 32);
1398-
Vector128<byte> block4 = AdvSimd.LoadVector128(pInputBuffer + processedLength + localasciirun + 48);
1399-
Vector128<byte> or = AdvSimd.Or(AdvSimd.Or(block1, block2), AdvSimd.Or(block3, block4));
1400-
if (AdvSimd.Arm64.MaxAcross(or).ToScalar() > 127)
1395+
Vector128<byte> block = AdvSimd.LoadVector128(pInputBuffer + processedLength + localasciirun);
1396+
if (AdvSimd.Arm64.MaxAcross(Vector128.AsUInt32(AdvSimd.And(block, v80))).ToScalar() != 0)
14011397
{
14021398
break;
14031399
}

0 commit comments

Comments
 (0)