mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 21:11:54 +00:00
Fix regressions.
svn path=/trunk/; revision=44466
This commit is contained in:
parent
4e6d2d7136
commit
8d819f40bb
1 changed files with 18 additions and 6 deletions
|
@ -417,7 +417,7 @@ RtlFindClearBits(
|
||||||
IN ULONG NumberToFind,
|
IN ULONG NumberToFind,
|
||||||
IN ULONG HintIndex)
|
IN ULONG HintIndex)
|
||||||
{
|
{
|
||||||
ULONG CurrentBit, CurrentLength;
|
ULONG CurrentBit, Margin, CurrentLength;
|
||||||
|
|
||||||
/* Check for valid parameters */
|
/* Check for valid parameters */
|
||||||
if (!BitMapHeader || NumberToFind > BitMapHeader->SizeOfBitMap)
|
if (!BitMapHeader || NumberToFind > BitMapHeader->SizeOfBitMap)
|
||||||
|
@ -431,12 +431,15 @@ RtlFindClearBits(
|
||||||
return HintIndex;
|
return HintIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* First margin is end of bitmap */
|
||||||
|
Margin = BitMapHeader->SizeOfBitMap;
|
||||||
|
|
||||||
|
retry:
|
||||||
/* Start with hint index, length is 0 */
|
/* Start with hint index, length is 0 */
|
||||||
CurrentBit = HintIndex;
|
CurrentBit = HintIndex;
|
||||||
CurrentLength = 0;
|
|
||||||
|
|
||||||
/* Loop until something is found or the end is reached */
|
/* Loop until something is found or the end is reached */
|
||||||
while (CurrentBit + NumberToFind < BitMapHeader->SizeOfBitMap)
|
while (CurrentBit + NumberToFind < Margin)
|
||||||
{
|
{
|
||||||
/* Search for the next clear run, by skipping a set run */
|
/* Search for the next clear run, by skipping a set run */
|
||||||
CurrentBit += RtlpGetLengthOfRunSet(BitMapHeader,
|
CurrentBit += RtlpGetLengthOfRunSet(BitMapHeader,
|
||||||
|
@ -458,6 +461,15 @@ RtlFindClearBits(
|
||||||
CurrentBit += CurrentLength;
|
CurrentBit += CurrentLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Did we start at a hint? */
|
||||||
|
if (HintIndex)
|
||||||
|
{
|
||||||
|
/* Retry at the start */
|
||||||
|
Margin = min(HintIndex + NumberToFind, BitMapHeader->SizeOfBitMap);
|
||||||
|
HintIndex = 0;
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
/* Nothing found */
|
/* Nothing found */
|
||||||
return MAXULONG;
|
return MAXULONG;
|
||||||
}
|
}
|
||||||
|
@ -571,10 +583,10 @@ RtlFindNextForwardRunClear(
|
||||||
|
|
||||||
/* Assume a set run first, count it's length */
|
/* Assume a set run first, count it's length */
|
||||||
Length = RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXULONG);
|
Length = RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXULONG);
|
||||||
*StartingRunIndex = FromIndex;
|
*StartingRunIndex = FromIndex + Length;
|
||||||
|
|
||||||
/* Now return the length of the run */
|
/* Now return the length of the run */
|
||||||
return RtlpGetLengthOfRunClear(BitMapHeader, FromIndex, MAXULONG);
|
return RtlpGetLengthOfRunClear(BitMapHeader, FromIndex + Length, MAXULONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
|
@ -647,7 +659,7 @@ RtlFindClearRuns(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Advance bits */
|
/* Advance bits */
|
||||||
FromIndex += NumberOfBits;
|
FromIndex = StartingIndex + NumberOfBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we are finished */
|
/* Check if we are finished */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue