Skip to content

Commit 76ecff2

Browse files
committed
Inlining + Fix bug
1 parent 1ea798e commit 76ecff2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,7 @@ internal static unsafe nuint WidenAsciiToUtf16(byte* pAsciiBuffer, char* pUtf16B
22282228
goto Finish;
22292229
}
22302230

2231+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
22312232
private static unsafe void WidenAsciiToUtf1_Vector<TVectorByte, TVectorUShort>(byte* pAsciiBuffer, char* pUtf16Buffer, ref nuint currentOffset, nuint elementCount)
22322233
where TVectorByte : unmanaged, ISimdVector<TVectorByte, byte>
22332234
where TVectorUShort : unmanaged, ISimdVector<TVectorUShort, ushort>
@@ -2238,7 +2239,7 @@ private static unsafe void WidenAsciiToUtf1_Vector<TVectorByte, TVectorUShort>(b
22382239
// write instructions. See: https://github.com/dotnet/runtime/issues/33002
22392240
nuint finalOffsetWhereCanRunLoop = elementCount - (nuint)TVectorByte.Count;
22402241
TVectorByte asciiVector = TVectorByte.Load(pAsciiBuffer + currentOffset);
2241-
if (HasNoMatch<TVectorByte>(asciiVector))
2242+
if (!HasMatch<TVectorByte>(asciiVector))
22422243
{
22432244
(TVectorUShort utf16LowVector, TVectorUShort utf16HighVector) = Widen<TVectorByte, TVectorUShort>(asciiVector);
22442245
utf16LowVector.Store(pCurrentWriteAddress);
@@ -2261,7 +2262,7 @@ private static unsafe void WidenAsciiToUtf1_Vector<TVectorByte, TVectorUShort>(b
22612262
while (currentOffset <= finalOffsetWhereCanRunLoop)
22622263
{
22632264
asciiVector = TVectorByte.Load(pAsciiBuffer + currentOffset);
2264-
if (HasNoMatch<TVectorByte>(asciiVector))
2265+
if (HasMatch<TVectorByte>(asciiVector))
22652266
{
22662267
break;
22672268
}
@@ -2278,14 +2279,14 @@ private static unsafe void WidenAsciiToUtf1_Vector<TVectorByte, TVectorUShort>(b
22782279
}
22792280

22802281
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2281-
private static unsafe bool HasNoMatch<TVectorByte>(TVectorByte vector)
2282+
private static unsafe bool HasMatch<TVectorByte>(TVectorByte vector)
22822283
where TVectorByte : unmanaged, ISimdVector<TVectorByte, byte>
22832284
{
22842285
if (AdvSimd.IsSupported && typeof(TVectorByte) == typeof(Vector128<byte>))
22852286
{
2286-
return !VectorContainsNonAsciiChar((Vector128<byte>)(object)vector);
2287+
return VectorContainsNonAsciiChar((Vector128<byte>)(object)vector);
22872288
}
2288-
return !TVectorByte.AnyMatches(vector);
2289+
return TVectorByte.AnyMatches(vector);
22892290
}
22902291

22912292

0 commit comments

Comments
 (0)