ReadOnlySequence
using System.Runtime.CompilerServices;
namespace System.Buffers
{
internal static class ReadOnlySequence
{
public const int FlagBitMask = int.MinValue;
public const int IndexBitMask = int.MaxValue;
public const int SegmentStartMask = 0;
public const int SegmentEndMask = 0;
public const int ArrayStartMask = 0;
public const int ArrayEndMask = int.MinValue;
public const int MemoryManagerStartMask = int.MinValue;
public const int MemoryManagerEndMask = 0;
public const int StringStartMask = int.MinValue;
public const int StringEndMask = int.MinValue;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int SegmentToSequenceStart(int startIndex)
{
return startIndex | 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int SegmentToSequenceEnd(int endIndex)
{
return endIndex | 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ArrayToSequenceStart(int startIndex)
{
return startIndex | 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ArrayToSequenceEnd(int endIndex)
{
return endIndex | -2147483648;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int MemoryManagerToSequenceStart(int startIndex)
{
return startIndex | -2147483648;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int MemoryManagerToSequenceEnd(int endIndex)
{
return endIndex | 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int StringToSequenceStart(int startIndex)
{
return startIndex | -2147483648;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int StringToSequenceEnd(int endIndex)
{
return endIndex | -2147483648;
}
}
}