Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ internal static partial class SpanHelpers // .T
{
public static int IndexOf<T>(ref T searchSpace, int searchSpaceLength, ref T value, int valueLength) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(searchSpaceLength >= 0);
Debug.Assert(valueLength >= 0);

Expand Down Expand Up @@ -52,9 +49,6 @@ public static int IndexOf<T>(ref T searchSpace, int searchSpaceLength, ref T val
// Adapted from IndexOf(...)
public static unsafe bool Contains<T>(ref T searchSpace, T value, int length) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(length >= 0);

IntPtr index = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
Expand Down Expand Up @@ -125,9 +119,6 @@ public static unsafe bool Contains<T>(ref T searchSpace, T value, int length) wh

public static unsafe int IndexOf<T>(ref T searchSpace, T value, int length) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(length >= 0);

IntPtr index = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
Expand Down Expand Up @@ -215,9 +206,6 @@ public static unsafe int IndexOf<T>(ref T searchSpace, T value, int length) wher

public static int IndexOfAny<T>(ref T searchSpace, T value0, T value1, int length) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(length >= 0);

T lookUp;
Expand Down Expand Up @@ -322,9 +310,6 @@ public static int IndexOfAny<T>(ref T searchSpace, T value0, T value1, int lengt

public static int IndexOfAny<T>(ref T searchSpace, T value0, T value1, T value2, int length) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(length >= 0);

T lookUp;
Expand Down Expand Up @@ -428,9 +413,6 @@ public static int IndexOfAny<T>(ref T searchSpace, T value0, T value1, T value2,

public static int IndexOfAny<T>(ref T searchSpace, int searchSpaceLength, ref T value, int valueLength) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(searchSpaceLength >= 0);
Debug.Assert(valueLength >= 0);

Expand Down Expand Up @@ -490,9 +472,6 @@ public static int LastIndexOf<T>(ref T searchSpace, int searchSpaceLength, ref T

public static int LastIndexOf<T>(ref T searchSpace, T value, int length) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(length >= 0);

if (default(T)! != null || (object)value != null) // TODO-NULLABLE: default(T) == null warning (https://github.com/dotnet/roslyn/issues/34757)
Expand Down Expand Up @@ -574,9 +553,6 @@ public static int LastIndexOf<T>(ref T searchSpace, T value, int length) where T

public static int LastIndexOfAny<T>(ref T searchSpace, T value0, T value1, int length) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(length >= 0);

T lookUp;
Expand Down Expand Up @@ -680,9 +656,6 @@ public static int LastIndexOfAny<T>(ref T searchSpace, T value0, T value1, int l

public static int LastIndexOfAny<T>(ref T searchSpace, T value0, T value1, T value2, int length) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(length >= 0);

T lookUp;
Expand Down Expand Up @@ -786,9 +759,6 @@ public static int LastIndexOfAny<T>(ref T searchSpace, T value0, T value1, T val

public static int LastIndexOfAny<T>(ref T searchSpace, int searchSpaceLength, ref T value, int valueLength) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(searchSpaceLength >= 0);
Debug.Assert(valueLength >= 0);

Expand All @@ -807,9 +777,6 @@ public static int LastIndexOfAny<T>(ref T searchSpace, int searchSpaceLength, re

public static bool SequenceEqual<T>(ref T first, ref T second, int length) where T : IEquatable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(!RuntimeHelpers.IsBitwiseEquatable<T>() || !(Unsafe.SizeOf<T>() == sizeof(byte) || Unsafe.SizeOf<T>() == sizeof(char)));

Debug.Assert(length >= 0);

if (Unsafe.AreSame(ref first, ref second))
Expand Down Expand Up @@ -902,9 +869,6 @@ public static bool SequenceEqual<T>(ref T first, ref T second, int length) where
public static int SequenceCompareTo<T>(ref T first, int firstLength, ref T second, int secondLength)
where T : IComparable<T>
{
// The optimized implementation should be used for these types
Debug.Assert(typeof(T) != typeof(byte) && typeof(T) != typeof(char));

Debug.Assert(firstLength >= 0);
Debug.Assert(secondLength >= 0);

Expand Down