Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetIndexOfPageWithFreeSlot()

int System.Data.RBTree< K >.GetIndexOfPageWithFreeSlot ( bool allocatedPage)
inlineprivate

Definition at line 342 of file RBTree.cs.

343 {
344 int i = _nextFreePageLine;
345 int result = -1;
346 for (; i < _pageTableMap.Length; i++)
347 {
348 if ((uint)_pageTableMap[i] >= uint.MaxValue)
349 {
350 continue;
351 }
352 uint num = (uint)_pageTableMap[i];
353 while ((num ^ 0xFFFFFFFFu) != 0)
354 {
355 uint num2 = ~num & (num + 1);
356 if ((_pageTableMap[i] & num2) != 0L)
357 {
358 throw ExceptionBuilder.InternalRBTreeError(RBTreeError.PagePositionInSlotInUse);
359 }
360 result = i * 32 + GetIntValueFromBitMap(num2);
361 if (allocatedPage)
362 {
363 if (_pageTable[result] != null)
364 {
365 return result;
366 }
367 }
368 else if (_pageTable[result] == null)
369 {
370 return result;
371 }
372 result = -1;
373 num |= num2;
374 }
375 }
376 if (_nextFreePageLine != 0)
377 {
380 }
381 return result;
382 }
int GetIndexOfPageWithFreeSlot(bool allocatedPage)
Definition RBTree.cs:342
int[] _pageTableMap
Definition RBTree.cs:203
static int GetIntValueFromBitMap(uint bitMap)
Definition RBTree.cs:294
TreePage[] _pageTable
Definition RBTree.cs:201

References System.Data.RBTree< K >._nextFreePageLine, System.Data.RBTree< K >._pageTable, System.Data.RBTree< K >._pageTableMap, System.Data.RBTree< K >.GetIndexOfPageWithFreeSlot(), System.Data.RBTree< K >.GetIntValueFromBitMap(), System.Data.ExceptionBuilder.InternalRBTreeError(), and System.L.

Referenced by System.Data.RBTree< K >.AllocPage(), System.Data.RBTree< K >.GetIndexOfPageWithFreeSlot(), and System.Data.RBTree< K >.GetNewNode().