RTools.Util.CharBuffer.Grow C# (CSharp) Method

Grow() protected method

Reallocate the buffer to be larger. For the new size, this uses the max of the requested length and double the current capacity. This does not shift, meaning it does not change the head or tail indices.
protected Grow ( int requestedLen ) : void
requestedLen int The new requested length.
return void
        protected void Grow(int requestedLen)
        {
            int newLen = Math.Max(capacity * 2, requestedLen);
            newLen = Math.Max(newLen, 16);
            char[] newBuffer = new char[newLen];
            Array.Copy(buffer, 0, newBuffer, 0, capacity);
            buffer = newBuffer;
            capacity = newLen;
        }