예제 #1
0
        public void Expand(ExpandableArray <TKey> keyBuffer, ExpandableArray <TValue> valueBuffer)
        {
            Assert.Debug.Check(keyBuffer.Length > 0);
            Assert.Debug.Check(keyBuffer.Length == valueBuffer.Length);

            _keyBuffer.ExpandByRef(ref keyBuffer);
            _valueBuffer.ExpandByRef(ref valueBuffer);
        }
예제 #2
0
 public ExpandableDictionary(Span <TKey> keys, Span <TValue> values)
 {
     Assert.Debug.Check(keys.Length > 0);
     Assert.Debug.Check(keys.Length == values.Length);
     _count       = 0;
     _keyBuffer   = keys;
     _valueBuffer = values;
 }
예제 #3
0
 public ExpandableQueue(Span <TItem> buffer)
 {
     Assert.Debug.Check(buffer.Length > 0);
     _count  = 0;
     _head   = 0;
     _tail   = 0;
     _buffer = buffer;
 }
예제 #4
0
        public void Expand(ExpandableArray <TItem> array)
        {
            Assert.Debug.Check(array.Length > 0);

            if (_chunk.Next == null)
            {
                _chunk.Next = &array._chunk;
                return;
            }

            var nextChunk = _chunk.Next;

            while (true)
            {
                if (nextChunk->Next == null)
                {
                    nextChunk->Next = &array._chunk;
                    return;
                }
            }
        }
예제 #5
0
        internal void ExpandByRef(ref ExpandableArray <TItem> array)
        {
            Assert.Debug.Check(array.Length > 0);

            fixed(ArrayChunk *chunkPtr = &array._chunk)
            {
                if (_chunk.Next == null)
                {
                    _chunk.Next = chunkPtr;
                    return;
                }

                var nextChunk = _chunk.Next;

                while (true)
                {
                    if (nextChunk->Next == null)
                    {
                        nextChunk->Next = chunkPtr;
                        return;
                    }
                }
            }
        }
예제 #6
0
 public ExpandableStack(Span <TItem> buffer)
 {
     Assert.Debug.Check(buffer.Length > 0);
     _count  = 0;
     _buffer = buffer;
 }
예제 #7
0
 public void Expand(ExpandableArray <TItem> buffer)
 {
     Assert.Debug.Check(buffer.Length > 0);
     _buffer.ExpandByRef(ref buffer);
     _tail = Capacity - 1;
 }