Esempio n. 1
0
        public void AllocatesDynamicTypes()
        {
            using var memory = new DynamicAllocator(_logFactory);
            using var buffer = new NativeBuffer(memory);
            var d0 = buffer.Add(new Data()
            {
                x = 10
            });

            buffer.Length.ShouldBe(4);

            var d1 = buffer.Add(new Data1()
            {
                x = 22, y = 33
            });

            buffer.Length.ShouldBe(12);

            var d2 = buffer.Add(new Data2()
            {
                z = 44, b = 2
            });

            buffer.Length.ShouldBe(20);
        }
 internal NativeBufferPtr(NativeBuffer buffer, int offset, int count, int sizeInBytes)
 {
     _buffer     = buffer;
     Offset      = offset;
     Count       = count;
     SizeInBytes = sizeInBytes;
 }