Beispiel #1
0
 private SafeBufferOwnedMemory(SafeBuffer buffer, long offset, int length, SafeBufferOwnedMemory <T> next)
 {
     _buffer = buffer;
     _offset = offset;
     _length = length;
     _next   = next;
 }
Beispiel #2
0
        public static ReadOnlyBuffer <T> CreateReadOnlyBuffer(SafeBuffer buffer, long offset, long length)
        {
            int count = (int)(length & 0x3FFF_FFFF);

            length -= count;
            offset += length;
            var last  = new SafeBufferOwnedMemory <T>(buffer, offset, count, null);
            var first = last;

            while (length > 0)
            {
                length -= 0x4000_0000;
                offset -= 0x4000_0000;
                first   = new SafeBufferOwnedMemory <T>(buffer, offset, 0x4000_0000, first);
            }

            return(new ReadOnlyBuffer <T>(first, 0, last, count));
        }
 public ReadOnlyBuffer <byte> CreateReadOnlyBuffer() => SafeBufferOwnedMemory <byte> .CreateReadOnlyBuffer(_buffer, _dataOffset, _dataLength);