Utilities\BigArray.cs (44)
34private const int BlockSizeMinusOne = BlockSize - 1;
93Contracts.Assert(BlockSize > 1 && (BlockSize & (BlockSize - 1)) == 0, "Block size is not a power of two.");
108Contracts.Assert(0 < lastBlockSize && lastBlockSize <= BlockSize);
112_entries[i] = new T[BlockSize];
204/// to the smallest integral multiple of <see cref="BlockSize"/> that is larger than <paramref name="newLength"/>,
205/// unless <paramref name="newLength"/> is less than <see cref="BlockSize"/>, in which case the capacity
207/// but up to <see cref="BlockSize"/>.
229Contracts.Assert(0 < newLastBlockLength && newLastBlockLength <= BlockSize);
235_entries[i] = new T[BlockSize];
246Contracts.Assert(0 < curLastBlockLength && curLastBlockLength <= curLastBlockSize && curLastBlockSize <= BlockSize);
267Array.Resize(ref _entries[0], Math.Min(BlockSize, Math.Max(2 * curLastBlockSize, newLastBlockLength)));
272Array.Resize(ref _entries[newBlockCount - 1], BlockSize);
281Array.Resize(ref _entries[curBlockCount - 1], BlockSize);
283_entries[bI] = new T[BlockSize];
332Utils.EnsureSize(ref _entries, maMax + 1, BlockSize);
338Utils.EnsureSize(ref _entries[maMax], maMax >= FullAllocationBeyond ? BlockSize : miLim, BlockSize);
343Contracts.Assert((BlockSize - miMin) + miLim == src.Length);
344Utils.EnsureSize(ref _entries[maMin], BlockSize, BlockSize);
345int firstSubArrayCapacity = BlockSize - miMin;
348Utils.EnsureSize(ref _entries[maMax], maMax >= FullAllocationBeyond ? BlockSize : miLim, BlockSize);
356Utils.EnsureSize(ref _entries[maMin], BlockSize, BlockSize);
357int srcSoFar = BlockSize - miMin;
363_entries[major] = new T[BlockSize];
364src.Slice(srcSoFar, BlockSize).CopyTo(_entries[major]);
365srcSoFar += BlockSize;
371Utils.EnsureSize(ref _entries[maMax], maMax >= FullAllocationBeyond ? BlockSize : miLim, BlockSize);
412Contracts.Assert((BlockSize - miMin) + miLim == length);
413Contracts.Assert(BlockSize <= Utils.Size(_entries[maMin]));
414_entries[maMin].AsSpan(miMin, BlockSize - miMin).CopyTo(dst);
416_entries[maMax].AsSpan(0, miLim).CopyTo(dst.Slice(BlockSize - miMin));
423Contracts.Assert(BlockSize <= Utils.Size(_entries[maMin]));
424int dstSoFar = BlockSize - miMin;
429Contracts.Assert(BlockSize <= Utils.Size(_entries[major]));
430_entries[major].AsSpan(0, BlockSize).CopyTo(dst.Slice(dstSoFar));
431dstSoFar += BlockSize;
448Contracts.Assert((long)major * BlockSize + minor == min);
458Contracts.Assert((long)major * BlockSize + minor == lim + 1);