}
// Adapted from IndexOf(...)
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe bool Contains(ref byte searchSpace, byte value, int length)
{
Debug.Assert(length >= 0);
return true;
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int IndexOf(ref byte searchSpace, byte value, int length)
{
Debug.Assert(length >= 0);
return -1;
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int LastIndexOf(ref byte searchSpace, byte value, int length)
{
Debug.Assert(length >= 0);
return (int)(byte*)(offset + 7);
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int IndexOfAny(ref byte searchSpace, byte value0, byte value1, int length)
{
Debug.Assert(length >= 0);
return (int)(byte*)(offset + 7);
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int IndexOfAny(ref byte searchSpace, byte value0, byte value1, byte value2, int length)
{
Debug.Assert(length >= 0);
// Optimized byte-based SequenceEquals. The "length" parameter for this one is declared a nuint rather than int as we also use it for types other than byte
// where the length can exceed 2Gb once scaled by sizeof(T).
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe bool SequenceEqual(ref byte first, ref byte second, nuint length)
{
if (Unsafe.AreSame(ref first, ref second))
return i * 8 + LocateFirstFoundByte(candidate);
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int SequenceCompareTo(ref byte first, int firstLength, ref byte second, int secondLength)
{
Debug.Assert(firstLength >= 0);
return -1;
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int SequenceCompareTo(ref char first, int firstLength, ref char second, int secondLength)
{
Debug.Assert(firstLength >= 0);
}
// Adapted from IndexOf(...)
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe bool Contains(ref char searchSpace, char value, int length)
{
Debug.Assert(length >= 0);
}
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int IndexOf(ref char searchSpace, char value, int length)
{
Debug.Assert(length >= 0);
}
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int IndexOfAny(ref char searchSpace, char value0, char value1, int length)
{
Debug.Assert(length >= 0);
}
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int IndexOfAny(ref char searchSpace, char value0, char value1, char value2, int length)
{
Debug.Assert(length >= 0);
}
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int IndexOfAny(ref char searchSpace, char value0, char value1, char value2, char value3, int length)
{
Debug.Assert(length >= 0);
}
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int IndexOfAny(ref char searchSpace, char value0, char value1, char value2, char value3, char value4, int length)
{
Debug.Assert(length >= 0);
}
}
+ [MethodImpl(MethodImplOptions.AggressiveOptimization)]
public static unsafe int LastIndexOf(ref char searchSpace, char value, int length)
{
Debug.Assert(length >= 0);