Esempio n. 1
0
        public void Release(ref OffsetLength ol)
        {
            if (!ol.IsEmpty)
            {
                var offset = 0;
                var length = 0;

                ol.GetOffsetLength(out offset, out length);

                heaps[length].Release(offset);
                ol = new OffsetLength();
            }
        }
Esempio n. 2
0
        public Handle <T> Dereference(OffsetLength ol)
        {
            if (ol.IsEmpty)
            {
                return(new Handle <T>(null, 0, 0));
            }
            else
            {
                var offset = 0;
                var length = 0;

                ol.GetOffsetLength(out offset, out length);

                return(heaps[length].Dereference(offset));
            }
        }
Esempio n. 3
0
        public Handle <T> EnsureAllocation(ref OffsetLength ol, int capacity)
        {
            if (ol.IsEmpty)
            {
                return(Allocate(out ol, capacity));
            }
            else
            {
                var offset = 0;
                var length = 0;

                ol.GetOffsetLength(out offset, out length);

                var handle = EnsureAllocation(ref offset, ref length, capacity);

                ol = new OffsetLength(offset, length);

                return(handle);
            }
        }