Esempio n. 1
0
        public static unsafe ReleaseMemory CloneTableValueReader(DocumentsOperationContext context, Table.TableValueHolder read)
        {
            var copyReadMemory = context.GetMemory(read.Reader.Size);

            Memory.Copy(copyReadMemory.Address, read.Reader.Pointer, read.Reader.Size);
            read.Reader = new TableValueReader(copyReadMemory.Address, read.Reader.Size);
            return(new ReleaseMemory(context, copyReadMemory));
        }
Esempio n. 2
0
        private ByteStringContext.ExternalScope GetResolvedSlice(DocumentsOperationContext context, DateTime date, out Slice slice)
        {
            var size = sizeof(int) + sizeof(long);
            var mem  = context.GetMemory(size);
            var flag = (int)DocumentFlags.Resolved;

            Memory.Copy(mem.Address, (byte *)&flag, sizeof(int));
            var ticks = Bits.SwapBytes(date.Ticks);

            Memory.Copy(mem.Address + sizeof(int), (byte *)&ticks, sizeof(long));
            return(Slice.External(context.Allocator, mem.Address, size, out slice));
        }