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

Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Prev Previous commit
Add comment
  • Loading branch information
benaadams committed Jan 23, 2019
commit 9ba65b563918c778c256f18e234be69174173f12
7 changes: 5 additions & 2 deletions src/System.Private.CoreLib/shared/System/SpanHelpers.Byte.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public static unsafe int IndexOf(ref byte searchSpace, byte value, int length)

if (Avx2.IsSupported || Sse2.IsSupported)
{
// Avx2 branch also operates on Sse2 sizes, so check is combined.
if (length >= Vector128<byte>.Count * 2)
{
nLength = UnalignedByteCountVector128(ref searchSpace);
Expand Down Expand Up @@ -537,6 +538,7 @@ public static unsafe int IndexOfAny(ref byte searchSpace, byte value0, byte valu

if (Avx2.IsSupported || Sse2.IsSupported)
{
// Avx2 branch also operates on Sse2 sizes, so check is combined.
if (length >= Vector128<byte>.Count * 2)
{
nLength = UnalignedByteCountVector128(ref searchSpace);
Expand Down Expand Up @@ -760,6 +762,7 @@ public static unsafe int IndexOfAny(ref byte searchSpace, byte value0, byte valu

if (Avx2.IsSupported || Sse2.IsSupported)
{
// Avx2 branch also operates on Sse2 sizes, so check is combined.
if (length >= Vector128<byte>.Count * 2)
{
nLength = UnalignedByteCountVector128(ref searchSpace);
Expand Down Expand Up @@ -1276,7 +1279,7 @@ public static unsafe bool SequenceEqual(ref byte first, ref byte second, nuint l

while ((byte*)nLength > (byte*)offset)
{
if (Unsafe.AddByteOffset(ref first, offset) != Unsafe.AddByteOffset(ref second, offset))
if (Unsafe.AddByteOffset(ref first, offset) != Unsafe.AddByteOffset(ref second, offset))
goto NotEqual;
offset += 1;
}
Expand Down Expand Up @@ -1351,7 +1354,7 @@ public static unsafe int SequenceCompareTo(ref byte first, int firstLength, ref
NotEqual: // Workaround for https://github.com/dotnet/coreclr/issues/13549
while ((byte*)minLength > (byte*)offset)
{
int result = Unsafe.AddByteOffset(ref first, offset).CompareTo(Unsafe.AddByteOffset(ref second, offset));
int result = Unsafe.AddByteOffset(ref first, offset).CompareTo(Unsafe.AddByteOffset(ref second, offset));
if (result != 0)
return result;
offset += 1;
Expand Down