Esempio n. 1
0
        public void TestFree()
        {
            var buffer = new ArrayBuffer <int>();
            int a      = buffer.Allocate(10);
            int b      = buffer.Allocate(20);
            int c      = buffer.Allocate(10);

            buffer.Free(20, b);
            buffer.Free(10, a);
            buffer.Free(10, c);
        }
Esempio n. 2
0
        public void TestAllocate()
        {
            var buffer = new ArrayBuffer <int>();

            buffer.Allocate(10);
            buffer.Map[0].Position.Should().Be(10);
            buffer.Map[0].Size.Should().Be(0);

            buffer.Allocate(10);
            buffer.Map[0].Position.Should().Be(20);
            buffer.Map[0].Size.Should().Be(0);

            buffer.Array.Count.Should().Be(20);
        }
Esempio n. 3
0
            public Span(ArrayBuffer <T> parent, int size)
            {
                start  = parent.Allocate(size);
                Length = size;

                this.parent = parent;
                last        = 0;
                Returned    = false;

                for (int i = start; i < start + size; i++)
                {
                    parent.array[i] = default;
                }
            }