Ejemplo n.º 1
0
        CopyFrom(
            NativeLog.IKIoBuffer IoBuffer,
            UInt32 SrcOffset,
            UInt32 Size,
            byte *ResultPtr)
        {
            // Compute current source location
            var src = new KIoBufferStream(IoBuffer, SrcOffset);

            // NOTE: ctor will fast path for single element KIoBuffers
            //       and code is inlined here

            if (src._TotalSize < (SrcOffset + Size))
            {
                return(false); // Out of range request
            }

            if (src.GetBufferPointerRange() >= Size)
            {
                // Optimize for moving totally within current element
                Memcopy(src._CurrentElementBufferBase + src._CurrentElementOffset, ResultPtr, Size);
                return(true);
            }

            // Will be crossing element boundary
            return(src.Pull(ResultPtr, Size));
        }
Ejemplo n.º 2
0
        CopyTo(
            NativeLog.IKIoBuffer IoBuffer,
            UInt32 DestOffset,
            UInt32 Size,
            byte *SrcPtr)
        {
            // Compute current destination location
            var dest = new KIoBufferStream(IoBuffer, DestOffset);

            // NOTE: ctor will fast path for single element KIoBuffers
            //       and code is inlined here

            if (dest._TotalSize < (DestOffset + Size))
            {
                return(false); // Out of range request
            }

            if (dest.GetBufferPointerRange() >= Size)
            {
                // Optimize for moving totally within current element
                Memcopy(SrcPtr, dest._CurrentElementBufferBase + dest._CurrentElementOffset, Size);
                return(true);
            }

            // Will be crossing element boundary
            return(dest.Put(SrcPtr, Size));
        }