public virtual void Merge(This other) { for (uint i = 0; i < other.NumSlots; i++) { var slotIdx = (int)(other.StartSlot + i); if (!SlotsMask.Contains(slotIdx)) { SlotsMask.Add(slotIdx); } } var overridden = SlotsPopulated.Where(s => s.Index >= other.StartSlot && s.Index < other.StartSlot + other.NumSlots).ToList(); overridden.ForEach(s => mergeWarnings.Add($"{(this as INamed).Name}: Overwriting slot {s.Index}")); overridden.ForEach(s => SlotsPopulated.Remove(s)); NumSlots = (uint)SlotsMask.Count; StartSlot = other.StartSlot < StartSlot ? other.StartSlot : StartSlot; PointersMerged ??= new List <ulong> { Pointer }; PointersMerged.Add(other.Pointer); }
private TSlot?GetSlot(int index) => SlotsMask.Contains(index) ? SlotsPopulated.FirstOrDefault(s => s.Index == index) : GetPrevious(index);