Skip to content

Commit

Permalink
Fixing perf
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepakRajendrakumaran committed Mar 26, 2024
1 parent 9994a5d commit 39cb56a
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2200,11 +2200,21 @@ private static unsafe void WidenAsciiToUtf1_Vector<TVectorByte, TVectorUShort>(b
private static unsafe bool HasMatch<TVectorByte>(TVectorByte vector)
where TVectorByte : unmanaged, ISimdVector<TVectorByte, byte>
{
if (typeof(TVectorByte) == typeof(Vector256<byte>))
{
return (((Vector256<byte>)(object)vector).ExtractMostSignificantBits() != 0);
}
else if (typeof(TVectorByte) == typeof(Vector512<byte>))
{
return (((Vector512<byte>)(object)vector).ExtractMostSignificantBits() != 0);
}

if (AdvSimd.IsSupported && typeof(TVectorByte) == typeof(Vector128<byte>))
{
return VectorContainsNonAsciiChar((Vector128<byte>)(object)vector);
}
return ((vector & TVectorByte.Create((byte)0b1000_0000)) != TVectorByte.Zero);

return (((Vector128<byte>)(object)vector).ExtractMostSignificantBits() != 0);
}


Expand Down

0 comments on commit 39cb56a

Please sign in to comment.