BitsetsNET.RoaringArray.ExtendArray C# (CSharp) Method

ExtendArray() public method

public ExtendArray ( int k ) : void
k int
return void
        public void ExtendArray(int k)
        {
            // size + 1 could overflow
            if (this.Size + k >= this.keys.Length)
            {
                int newCapacity;
                if (this.keys.Length < 1024)
                {
                    newCapacity = 2 * (this.Size + k);
                }
                else
                {
                    newCapacity = 5 * (this.Size + k) / 4;
                }
                //TODO: this may be jank
                Array.Resize(ref this.keys, newCapacity);
                Array.Resize(ref this.values, newCapacity);
            }
        }