// A == 1 && B == 0 means SequenceType.MemoryManager
// A == 1 && B == 0 means SequenceType.MemoryManager
// The type == char check here is redundant. However, we still have it to allow
// The type == char check here is redundant. However, we still have it to allow
// the JIT to see when that the code is unreachable and eliminate it.
// the JIT to see when that the code is unreachable and eliminate it.
if (typeof(T) == typeof(char) && endIndex < 0) // SequenceType.String
if (typeof(T) == typeof(char) && endIndex < 0) // SequenceType.String
{
{
var memory = (ReadOnlyMemory<T>)(object)((string)startObject).AsMemory();
// No need to remove the FlagBitMask since (endIndex - startIndex) == (endIndex & ReadOnlySequence.IndexBitMask) - (startIndex & ReadOnlySequence.IndexBitMask)
// No need to remove the FlagBitMask since (endIndex - startIndex) == (endIndex & ReadOnlySequence.IndexBitMask) - (startIndex & ReadOnlySequence.IndexBitMask)