private int RemoveFromListHead(ref UsagePageList list) { int pageIndex = list._head; this.RemoveFromList(pageIndex, ref list); return(pageIndex); }
private void RemoveFromList(int pageIndex, ref UsagePageList list) { Debug.Assert((list._head == -1) == (list._tail == -1), "(list._head == -1) == (list._tail == -1)"); if ((_pages[(pageIndex)]._pagePrev) != -1) { Debug.Assert((_pages[((_pages[(pageIndex)]._pagePrev))]._pageNext) == pageIndex, "PageNext(PagePrev(pageIndex)) == pageIndex"); (_pages[((_pages[(pageIndex)]._pagePrev))]._pageNext) = (_pages[(pageIndex)]._pageNext); } else { Debug.Assert(list._head == pageIndex, "list._head == pageIndex"); list._head = (_pages[(pageIndex)]._pageNext); } if ((_pages[(pageIndex)]._pageNext) != -1) { Debug.Assert((_pages[((_pages[(pageIndex)]._pageNext))]._pagePrev) == pageIndex, "PagePrev(PageNext(pageIndex)) == pageIndex"); (_pages[((_pages[(pageIndex)]._pageNext))]._pagePrev) = (_pages[(pageIndex)]._pagePrev); } else { Debug.Assert(list._tail == pageIndex, "list._tail == pageIndex"); list._tail = (_pages[(pageIndex)]._pagePrev); } (_pages[(pageIndex)]._pagePrev) = -1; (_pages[(pageIndex)]._pageNext) = -1; }
private void MoveToListTail(int pageIndex, ref UsagePageList list) { if (list._tail != pageIndex) { this.RemoveFromList(pageIndex, ref list); this.AddToListTail(pageIndex, ref list); } }
private void MoveToListHead(int pageIndex, ref UsagePageList list) { if (list._head != pageIndex) { this.RemoveFromList(pageIndex, ref list); this.AddToListHead(pageIndex, ref list); } }
private int RemoveFromListHead(ref UsagePageList list) { Debug.Assert(list._head != -1, "list._head != -1"); int oldHead = list._head; RemoveFromList(oldHead, ref list); return(oldHead); }
private void MoveToListTail(int pageIndex, ref UsagePageList list) { Debug.Assert(list._head != -1, "list._head != -1"); Debug.Assert(list._tail != -1, "list._tail != -1"); if (list._tail == pageIndex) { return; } RemoveFromList(pageIndex, ref list); AddToListTail(pageIndex, ref list); }
private void AddToListTail(int pageIndex, ref UsagePageList list) { this._pages[pageIndex]._pageNext = -1; this._pages[pageIndex]._pagePrev = list._tail; if (list._tail != -1) { this._pages[list._tail]._pageNext = pageIndex; } else { list._head = pageIndex; } list._tail = pageIndex; }
private void AddToListHead(int pageIndex, ref UsagePageList list) { this._pages[pageIndex]._pagePrev = -1; this._pages[pageIndex]._pageNext = list._head; if (list._head != -1) { this._pages[list._head]._pagePrev = pageIndex; } else { list._tail = pageIndex; } list._head = pageIndex; }
private void AddToListTail(int pageIndex, ref UsagePageList list) { Debug.Assert((list._head == -1) == (list._tail == -1), "(list._head == -1) == (list._tail == -1)"); (_pages[(pageIndex)]._pageNext) = -1; (_pages[(pageIndex)]._pagePrev) = list._tail; if (list._tail != -1) { Debug.Assert((_pages[(list._tail)]._pageNext) == -1, "PageNext(list._tail) == -1"); (_pages[(list._tail)]._pageNext) = pageIndex; } else { list._head = pageIndex; } list._tail = pageIndex; }
private void RemoveFromList(int pageIndex, ref UsagePageList list) { if (this._pages[pageIndex]._pagePrev != -1) { this._pages[this._pages[pageIndex]._pagePrev]._pageNext = this._pages[pageIndex]._pageNext; } else { list._head = this._pages[pageIndex]._pageNext; } if (this._pages[pageIndex]._pageNext != -1) { this._pages[this._pages[pageIndex]._pageNext]._pagePrev = this._pages[pageIndex]._pagePrev; } else { list._tail = this._pages[pageIndex]._pagePrev; } this._pages[pageIndex]._pagePrev = -1; this._pages[pageIndex]._pageNext = -1; }
private int RemoveFromListHead(ref UsagePageList list) { int pageIndex = list._head; this.RemoveFromList(pageIndex, ref list); return pageIndex; }