示例#1
0
    internal ReadOnlySpan <T> this[long lo, long hi]
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            var index1 = (int)(lo & _indexMask);
            var index2 = (int)(hi & _indexMask);
            var length = index1 <= index2 ? (1 + index2 - index1) : (_bufferSize - index1);

            return(InternalUtil.ReadSpan <T>(_entries, _bufferPadRef + index1, length));
        }
    }
示例#2
0
    public void ShouldReadObjectBlockFromArray(int blockSize)
    {
        var array = Enumerable.Range(0, 2000).Select(x => new StubEvent(x)).ToArray();

        for (var i = 0; i < array.Length - blockSize + 1; i++)
        {
            var block = InternalUtil.ReadSpan <StubEvent>(array, i, blockSize);

            Assert.AreEqual(blockSize, block.Length);
            for (var dataIndex = 0; dataIndex < blockSize; dataIndex++)
            {
                Assert.AreEqual(new StubEvent(i + dataIndex), block[dataIndex]);
            }
        }
    }
 public ReadOnlySpan <Event> this[long lo, long hi]
 {
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     get { return(InternalUtil.ReadSpan <Event>(_dataArray, 0, 1)); }
 }
示例#4
0
    public ReadOnlySpan <Event> ReadSpanIL()
    {
        var sequence = NextSequence();

        return(InternalUtil.ReadSpan <Event>(_array, sequence, sequence));
    }