Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Prev Previous commit
Next Next commit
Replace another ShiftRightLogical with '>>>'
  • Loading branch information
MihaZupan committed Mar 8, 2023
commit 22953700f9e0976e4a00e34ccf69a19cf346e1a1
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private static Vector256<byte> ContainsMask32CharsAvx2(Vector256<byte> charMapLo
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static Vector256<byte> IsCharBitNotSetAvx2(Vector256<byte> charMapLower, Vector256<byte> charMapUpper, Vector256<byte> values)
{
// X86 doesn't have a logical right shift intrinsic for bytes: https://github.com/dotnet/runtime/issues/82564
Vector256<byte> highNibble = (values.AsInt32() >>> VectorizedIndexShift).AsByte() & Vector256.Create((byte)15);

Vector256<byte> bitPositions = Avx2.Shuffle(Vector256.Create(0x8040201008040201).AsByte(), highNibble);
Expand Down Expand Up @@ -163,9 +164,10 @@ private static Vector128<byte> ContainsMask16Chars(Vector128<byte> charMapLower,
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static Vector128<byte> IsCharBitNotSet(Vector128<byte> charMapLower, Vector128<byte> charMapUpper, Vector128<byte> values)
{
// X86 doesn't have a logical right shift intrinsic for bytes: https://github.com/dotnet/runtime/issues/82564
Vector128<byte> highNibble = Sse2.IsSupported
? (values.AsInt32() >>> VectorizedIndexShift).AsByte() & Vector128.Create((byte)15)
: AdvSimd.ShiftRightLogical(values, VectorizedIndexShift);
: values >>> VectorizedIndexShift;

Vector128<byte> bitPositions = Vector128.ShuffleUnsafe(Vector128.Create(0x8040201008040201).AsByte(), highNibble);

Expand Down