public virtual void AdvanceReader(int count) { if (count < 0) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count); } if (0u >= (uint)count) { return; } var readerIdx = _readerIndex + count; var writerIdx = _writerIndex; if (CheckBounds && readerIdx > writerIdx) { ThrowHelper.ThrowIndexOutOfRangeException_ReaderIndex(readerIdx, writerIdx); } _readerIndex = readerIdx; }
public ReceiveBufferSizeEstimate(int minimum = DefaultMinimum, int initial = DefaultInitial, int maximum = DefaultMaximum) { if ((uint)(minimum - 1) > SharedConstants.TooBigOrNegative) { ThrowHelper.ThrowArgumentException_Positive(minimum, ExceptionArgument.minimum); } if (initial < minimum) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.initial); } if (initial > maximum) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.maximum); } int min = GetSizeTableIndex(minimum); if (SizeTable[min] < minimum) { _minIndex = min + 1; } else { _minIndex = min; } int max = GetSizeTableIndex(maximum); if (SizeTable[max] > maximum) { _maxIndex = max - 1; } else { _maxIndex = max; } _index = GetSizeTableIndex(initial); _receiveBufferSize = SizeTable[_index]; }
public virtual void Advance(int count) { if (count < 0) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count); } if (0u >= (uint)count) { return; } var capacity = Capacity; var writerIdx = _writerIndex + count; if (CheckBounds && writerIdx > capacity) { ThrowHelper.ThrowInvalidOperationException(capacity); } _writerIndex = writerIdx; }