Update RTL_BITMAP and RTL_BITMAP_RUN to match the 2000 DDK.

Only test the Rtl{Initialize,SetAll,ClearAll}Bits macros if they are
defined.
This commit is contained in:
Francois Gouget 2004-08-23 18:52:54 +00:00 committed by Alexandre Julliard
parent 560462a2d0
commit 61d21ce706
5 changed files with 95 additions and 118 deletions

View File

@ -429,7 +429,7 @@ _FUNCTION_ {
_CHAR_ *str = suppress ? NULL : va_arg(ap, _CHAR_*); _CHAR_ *str = suppress ? NULL : va_arg(ap, _CHAR_*);
_CHAR_ *sptr = str; _CHAR_ *sptr = str;
RTL_BITMAP bitMask; RTL_BITMAP bitMask;
LPBYTE Mask; ULONG *Mask;
int invert = 0; /* Set if we are NOT to find the chars */ int invert = 0; /* Set if we are NOT to find the chars */
/* Init our bitmap */ /* Init our bitmap */

View File

@ -75,12 +75,11 @@ static const signed char NTDLL_mostSignificant[16] = {
* lpBuff must be aligned on a ULONG suitable boundary, to a multiple of 32 bytes * lpBuff must be aligned on a ULONG suitable boundary, to a multiple of 32 bytes
* in size (irrespective of ulSize given). * in size (irrespective of ulSize given).
*/ */
#undef RtlInitializeBitMap VOID WINAPI RtlInitializeBitMap(PRTL_BITMAP lpBits, PULONG lpBuff, ULONG ulSize)
VOID WINAPI RtlInitializeBitMap(PRTL_BITMAP lpBits, LPBYTE lpBuff, ULONG ulSize)
{ {
TRACE("(%p,%p,%ld)\n", lpBits,lpBuff,ulSize); TRACE("(%p,%p,%ld)\n", lpBits,lpBuff,ulSize);
lpBits->SizeOfBitMap = ulSize; lpBits->SizeOfBitMap = ulSize;
lpBits->BitMapBuffer = lpBuff; lpBits->Buffer = lpBuff;
} }
/************************************************************************* /*************************************************************************
@ -94,11 +93,10 @@ VOID WINAPI RtlInitializeBitMap(PRTL_BITMAP lpBits, LPBYTE lpBuff, ULONG ulSize)
* RETURNS * RETURNS
* Nothing. * Nothing.
*/ */
#undef RtlSetAllBits
VOID WINAPI RtlSetAllBits(PRTL_BITMAP lpBits) VOID WINAPI RtlSetAllBits(PRTL_BITMAP lpBits)
{ {
TRACE("(%p)\n", lpBits); TRACE("(%p)\n", lpBits);
memset(lpBits->BitMapBuffer, 0xff, ((lpBits->SizeOfBitMap + 31) & ~31) >> 3); memset(lpBits->Buffer, 0xff, ((lpBits->SizeOfBitMap + 31) & ~31) >> 3);
} }
/************************************************************************* /*************************************************************************
@ -112,11 +110,10 @@ VOID WINAPI RtlSetAllBits(PRTL_BITMAP lpBits)
* RETURNS * RETURNS
* Nothing. * Nothing.
*/ */
#undef RtlClearAllBits
VOID WINAPI RtlClearAllBits(PRTL_BITMAP lpBits) VOID WINAPI RtlClearAllBits(PRTL_BITMAP lpBits)
{ {
TRACE("(%p)\n", lpBits); TRACE("(%p)\n", lpBits);
memset(lpBits->BitMapBuffer, 0, ((lpBits->SizeOfBitMap + 31) & ~31) >> 3); memset(lpBits->Buffer, 0, ((lpBits->SizeOfBitMap + 31) & ~31) >> 3);
} }
/************************************************************************* /*************************************************************************
@ -143,7 +140,10 @@ VOID WINAPI RtlSetBits(PRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount)
ulCount > lpBits->SizeOfBitMap - ulStart) ulCount > lpBits->SizeOfBitMap - ulStart)
return; return;
lpOut = lpBits->BitMapBuffer + (ulStart >> 3u); /* FIXME: It might be more efficient/cleaner to manipulate four bytes
* at a time. But beware of the pointer arithmetics...
*/
lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u);
/* Set bits in first byte, if ulStart isn't a byte boundary */ /* Set bits in first byte, if ulStart isn't a byte boundary */
if (ulStart & 7) if (ulStart & 7)
@ -200,7 +200,10 @@ VOID WINAPI RtlClearBits(PRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount)
ulCount > lpBits->SizeOfBitMap - ulStart) ulCount > lpBits->SizeOfBitMap - ulStart)
return; return;
lpOut = lpBits->BitMapBuffer + (ulStart >> 3u); /* FIXME: It might be more efficient/cleaner to manipulate four bytes
* at a time. But beware of the pointer arithmetics...
*/
lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u);
/* Clear bits in first byte, if ulStart isn't a byte boundary */ /* Clear bits in first byte, if ulStart isn't a byte boundary */
if (ulStart & 7) if (ulStart & 7)
@ -260,7 +263,10 @@ BOOLEAN WINAPI RtlAreBitsSet(PCRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount)
ulCount > lpBits->SizeOfBitMap - ulStart) ulCount > lpBits->SizeOfBitMap - ulStart)
return FALSE; return FALSE;
lpOut = lpBits->BitMapBuffer + (ulStart >> 3u); /* FIXME: It might be more efficient/cleaner to manipulate four bytes
* at a time. But beware of the pointer arithmetics...
*/
lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u);
/* Check bits in first byte, if ulStart isn't a byte boundary */ /* Check bits in first byte, if ulStart isn't a byte boundary */
if (ulStart & 7) if (ulStart & 7)
@ -330,7 +336,10 @@ BOOLEAN WINAPI RtlAreBitsClear(PCRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount
ulCount > lpBits->SizeOfBitMap - ulStart) ulCount > lpBits->SizeOfBitMap - ulStart)
return FALSE; return FALSE;
lpOut = lpBits->BitMapBuffer + (ulStart >> 3u); /* FIXME: It might be more efficient/cleaner to manipulate four bytes
* at a time. But beware of the pointer arithmetics...
*/
lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u);
/* Check bits in first byte, if ulStart isn't a byte boundary */ /* Check bits in first byte, if ulStart isn't a byte boundary */
if (ulStart & 7) if (ulStart & 7)
@ -534,7 +543,7 @@ ULONG WINAPI RtlNumberOfSetBits(PCRTL_BITMAP lpBits)
if (lpBits) if (lpBits)
{ {
LPBYTE lpOut = lpBits->BitMapBuffer; LPBYTE lpOut = (BYTE *)lpBits->Buffer;
ULONG ulCount, ulRemainder; ULONG ulCount, ulRemainder;
BYTE bMasked; BYTE bMasked;
@ -654,7 +663,7 @@ CCHAR WINAPI RtlFindLeastSignificantBit(ULONGLONG ulLong)
*/ */
static int NTDLL_RunSortFn(const void *lhs, const void *rhs) static int NTDLL_RunSortFn(const void *lhs, const void *rhs)
{ {
if (((const RTL_BITMAP_RUN*)lhs)->SizeOfRun > ((const RTL_BITMAP_RUN*)rhs)->SizeOfRun) if (((const RTL_BITMAP_RUN*)lhs)->NumberOfBits > ((const RTL_BITMAP_RUN*)rhs)->NumberOfBits)
return -1; return -1;
return 1; return 1;
} }
@ -669,7 +678,10 @@ static ULONG NTDLL_FindSetRun(PCRTL_BITMAP lpBits, ULONG ulStart, PULONG lpSize)
LPBYTE lpOut; LPBYTE lpOut;
ULONG ulFoundAt = 0, ulCount = 0; ULONG ulFoundAt = 0, ulCount = 0;
lpOut = lpBits->BitMapBuffer + (ulStart >> 3u); /* FIXME: It might be more efficient/cleaner to manipulate four bytes
* at a time. But beware of the pointer arithmetics...
*/
lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u);
while (1) while (1)
{ {
@ -757,7 +769,10 @@ static ULONG NTDLL_FindClearRun(PCRTL_BITMAP lpBits, ULONG ulStart, PULONG lpSiz
LPBYTE lpOut; LPBYTE lpOut;
ULONG ulFoundAt = 0, ulCount = 0; ULONG ulFoundAt = 0, ulCount = 0;
lpOut = lpBits->BitMapBuffer + (ulStart >> 3u); /* FIXME: It might be more efficient/cleaner to manipulate four bytes
* at a time. But beware of the pointer arithmetics...
*/
lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u);
while (1) while (1)
{ {
@ -963,21 +978,21 @@ static ULONG WINAPI NTDLL_FindRuns(PCRTL_BITMAP lpBits, PRTL_BITMAP_RUN lpSeries
qsort(lpSeries, ulRuns, sizeof(RTL_BITMAP_RUN), NTDLL_RunSortFn); qsort(lpSeries, ulRuns, sizeof(RTL_BITMAP_RUN), NTDLL_RunSortFn);
/* Replace last run if this one is bigger */ /* Replace last run if this one is bigger */
if (ulSize > lpSeries[ulRuns - 1].SizeOfRun) if (ulSize > lpSeries[ulRuns - 1].NumberOfBits)
{ {
lpSeries[ulRuns - 1].StartOfRun = ulNextPos; lpSeries[ulRuns - 1].StartingIndex = ulNextPos;
lpSeries[ulRuns - 1].SizeOfRun = ulSize; lpSeries[ulRuns - 1].NumberOfBits = ulSize;
/* We need to re-sort the array, _if_ we didn't leave it sorted */ /* We need to re-sort the array, _if_ we didn't leave it sorted */
if (ulRuns > 1 && ulSize > lpSeries[ulRuns - 2].SizeOfRun) if (ulRuns > 1 && ulSize > lpSeries[ulRuns - 2].NumberOfBits)
bNeedSort = TRUE; bNeedSort = TRUE;
} }
} }
else else
{ {
/* Append to found runs */ /* Append to found runs */
lpSeries[ulRuns].StartOfRun = ulNextPos; lpSeries[ulRuns].StartingIndex = ulNextPos;
lpSeries[ulRuns].SizeOfRun = ulSize; lpSeries[ulRuns].NumberOfBits = ulSize;
ulRuns++; ulRuns++;
if (!bLongest && ulRuns == ulCount) if (!bLongest && ulRuns == ulCount)
@ -1053,8 +1068,8 @@ ULONG WINAPI RtlFindLongestRunSet(PCRTL_BITMAP lpBits, PULONG pulStart)
if (RtlFindSetRuns(lpBits, &br, 1, TRUE) == 1) if (RtlFindSetRuns(lpBits, &br, 1, TRUE) == 1)
{ {
if (pulStart) if (pulStart)
*pulStart = br.StartOfRun; *pulStart = br.StartingIndex;
return br.SizeOfRun; return br.NumberOfBits;
} }
return 0; return 0;
} }
@ -1080,8 +1095,8 @@ ULONG WINAPI RtlFindLongestRunClear(PCRTL_BITMAP lpBits, PULONG pulStart)
if (RtlFindClearRuns(lpBits, &br, 1, TRUE) == 1) if (RtlFindClearRuns(lpBits, &br, 1, TRUE) == 1)
{ {
if (pulStart) if (pulStart)
*pulStart = br.StartOfRun; *pulStart = br.StartingIndex;
return br.SizeOfRun; return br.NumberOfBits;
} }
return 0; return 0;
} }

View File

@ -75,7 +75,7 @@ static void InitFunctionPtrs()
static void test_RtlInitializeBitMap(void) static void test_RtlInitializeBitMap(void)
{ {
bm.SizeOfBitMap = 0; bm.SizeOfBitMap = 0;
bm.BitMapBuffer = 0; bm.Buffer = 0;
memset(buff, 0, sizeof(buff)); memset(buff, 0, sizeof(buff));
buff[0] = 77; /* Check buffer is not written to during init */ buff[0] = 77; /* Check buffer is not written to during init */
@ -83,13 +83,7 @@ static void test_RtlInitializeBitMap(void)
pRtlInitializeBitMap(&bm, buff, 800); pRtlInitializeBitMap(&bm, buff, 800);
ok(bm.SizeOfBitMap == 800, "size uninitialised\n"); ok(bm.SizeOfBitMap == 800, "size uninitialised\n");
ok(bm.BitMapBuffer == buff,"buffer uninitialised\n"); ok(bm.Buffer == (PULONG)buff,"buffer uninitialised\n");
ok(buff[0] == 77 && buff[79] == 77, "wrote to buffer\n");
/* Test inlined version */
RtlInitializeBitMap(&bm, buff, 800);
ok(bm.SizeOfBitMap == 800, "size uninitialised\n");
ok(bm.BitMapBuffer == buff,"buffer uninitialised\n");
ok(buff[0] == 77 && buff[79] == 77, "wrote to buffer\n"); ok(buff[0] == 77 && buff[79] == 77, "wrote to buffer\n");
} }
@ -105,13 +99,6 @@ static void test_RtlSetAllBits(void)
ok(buff[0] == 0xff && buff[1] == 0xff && buff[2] == 0xff && ok(buff[0] == 0xff && buff[1] == 0xff && buff[2] == 0xff &&
buff[3] == 0xff, "didn't round up size\n"); buff[3] == 0xff, "didn't round up size\n");
ok(buff[4] == 0, "set more than rounded size\n"); ok(buff[4] == 0, "set more than rounded size\n");
/* Test inlined version */
memset(buff, 0 , sizeof(buff));
RtlSetAllBits(&bm);
ok(buff[0] == 0xff && buff[1] == 0xff && buff[2] == 0xff &&
buff[3] == 0xff, "didn't round up size\n");
ok(buff[4] == 0, "set more than rounded size\n");
} }
static void test_RtlClearAllBits() static void test_RtlClearAllBits()
@ -125,12 +112,6 @@ static void test_RtlClearAllBits()
pRtlClearAllBits(&bm); pRtlClearAllBits(&bm);
ok(!buff[0] && !buff[1] && !buff[2] && !buff[3], "didn't round up size\n"); ok(!buff[0] && !buff[1] && !buff[2] && !buff[3], "didn't round up size\n");
ok(buff[4] == 0xff, "cleared more than rounded size\n"); ok(buff[4] == 0xff, "cleared more than rounded size\n");
/* Test inlined version */
memset(buff, 0xff , sizeof(buff));
RtlClearAllBits(&bm);
ok(!buff[0] && !buff[1] && !buff[2] && !buff[3] , "didn't round up size\n");
ok(buff[4] == 0xff, "cleared more than rounded size\n");
} }
static void test_RtlSetBits() static void test_RtlSetBits()
@ -498,8 +479,8 @@ static void test_RtlFindSetRuns()
memset(buff, 0xff, sizeof(buff)); memset(buff, 0xff, sizeof(buff));
ulCount = pRtlFindSetRuns(&bm, runs, 16, TRUE); ulCount = pRtlFindSetRuns(&bm, runs, 16, TRUE);
ok (ulCount == 1, "didn't find set bits\n"); ok (ulCount == 1, "didn't find set bits\n");
ok (runs[0].StartOfRun == 0,"bad start\n"); ok (runs[0].StartingIndex == 0,"bad start\n");
ok (runs[0].SizeOfRun == sizeof(buff)*8,"bad size\n"); ok (runs[0].NumberOfBits == sizeof(buff)*8,"bad size\n");
/* Set up 3 runs */ /* Set up 3 runs */
memset(runs, 0, sizeof(runs)); memset(runs, 0, sizeof(runs));
@ -510,35 +491,35 @@ static void test_RtlFindSetRuns()
/* Get first 2 */ /* Get first 2 */
ulCount = pRtlFindSetRuns(&bm, runs, 2, FALSE); ulCount = pRtlFindSetRuns(&bm, runs, 2, FALSE);
ok (runs[0].StartOfRun == 7 || runs[0].StartOfRun == 101,"bad find\n"); ok (runs[0].StartingIndex == 7 || runs[0].StartingIndex == 101,"bad find\n");
ok (runs[1].StartOfRun == 7 || runs[1].StartOfRun == 101,"bad find\n"); ok (runs[1].StartingIndex == 7 || runs[1].StartingIndex == 101,"bad find\n");
ok (runs[0].SizeOfRun + runs[1].SizeOfRun == 19 + 3,"bad size\n"); ok (runs[0].NumberOfBits + runs[1].NumberOfBits == 19 + 3,"bad size\n");
ok (runs[0].StartOfRun != runs[1].StartOfRun,"found run twice\n"); ok (runs[0].StartingIndex != runs[1].StartingIndex,"found run twice\n");
ok (runs[2].StartOfRun == 0,"found extra run\n"); ok (runs[2].StartingIndex == 0,"found extra run\n");
/* Get longest 3 */ /* Get longest 3 */
memset(runs, 0, sizeof(runs)); memset(runs, 0, sizeof(runs));
ulCount = pRtlFindSetRuns(&bm, runs, 2, TRUE); ulCount = pRtlFindSetRuns(&bm, runs, 2, TRUE);
ok (runs[0].StartOfRun == 7 || runs[0].StartOfRun == 1877,"bad find\n"); ok (runs[0].StartingIndex == 7 || runs[0].StartingIndex == 1877,"bad find\n");
ok (runs[1].StartOfRun == 7 || runs[1].StartOfRun == 1877,"bad find\n"); ok (runs[1].StartingIndex == 7 || runs[1].StartingIndex == 1877,"bad find\n");
ok (runs[0].SizeOfRun + runs[1].SizeOfRun == 33 + 19,"bad size\n"); ok (runs[0].NumberOfBits + runs[1].NumberOfBits == 33 + 19,"bad size\n");
ok (runs[0].StartOfRun != runs[1].StartOfRun,"found run twice\n"); ok (runs[0].StartingIndex != runs[1].StartingIndex,"found run twice\n");
ok (runs[2].StartOfRun == 0,"found extra run\n"); ok (runs[2].StartingIndex == 0,"found extra run\n");
/* Get all 3 */ /* Get all 3 */
memset(runs, 0, sizeof(runs)); memset(runs, 0, sizeof(runs));
ulCount = pRtlFindSetRuns(&bm, runs, 3, TRUE); ulCount = pRtlFindSetRuns(&bm, runs, 3, TRUE);
ok (runs[0].StartOfRun == 7 || runs[0].StartOfRun == 101 || ok (runs[0].StartingIndex == 7 || runs[0].StartingIndex == 101 ||
runs[0].StartOfRun == 1877,"bad find\n"); runs[0].StartingIndex == 1877,"bad find\n");
ok (runs[1].StartOfRun == 7 || runs[1].StartOfRun == 101 || ok (runs[1].StartingIndex == 7 || runs[1].StartingIndex == 101 ||
runs[1].StartOfRun == 1877,"bad find\n"); runs[1].StartingIndex == 1877,"bad find\n");
ok (runs[2].StartOfRun == 7 || runs[2].StartOfRun == 101 || ok (runs[2].StartingIndex == 7 || runs[2].StartingIndex == 101 ||
runs[2].StartOfRun == 1877,"bad find\n"); runs[2].StartingIndex == 1877,"bad find\n");
ok (runs[0].SizeOfRun + runs[1].SizeOfRun ok (runs[0].NumberOfBits + runs[1].NumberOfBits
+ runs[2].SizeOfRun == 19 + 3 + 33,"bad size\n"); + runs[2].NumberOfBits == 19 + 3 + 33,"bad size\n");
ok (runs[0].StartOfRun != runs[1].StartOfRun,"found run twice\n"); ok (runs[0].StartingIndex != runs[1].StartingIndex,"found run twice\n");
ok (runs[1].StartOfRun != runs[2].StartOfRun,"found run twice\n"); ok (runs[1].StartingIndex != runs[2].StartingIndex,"found run twice\n");
ok (runs[3].StartOfRun == 0,"found extra run\n"); ok (runs[3].StartingIndex == 0,"found extra run\n");
if (pRtlFindLongestRunSet) if (pRtlFindLongestRunSet)
{ {
@ -572,8 +553,8 @@ static void test_RtlFindClearRuns()
memset(buff, 0, sizeof(buff)); memset(buff, 0, sizeof(buff));
ulCount = pRtlFindClearRuns(&bm, runs, 16, TRUE); ulCount = pRtlFindClearRuns(&bm, runs, 16, TRUE);
ok (ulCount == 1, "didn't find clear bits\n"); ok (ulCount == 1, "didn't find clear bits\n");
ok (runs[0].StartOfRun == 0,"bad start\n"); ok (runs[0].StartingIndex == 0,"bad start\n");
ok (runs[0].SizeOfRun == sizeof(buff)*8,"bad size\n"); ok (runs[0].NumberOfBits == sizeof(buff)*8,"bad size\n");
/* Set up 3 runs */ /* Set up 3 runs */
memset(runs, 0, sizeof(runs)); memset(runs, 0, sizeof(runs));
@ -584,35 +565,35 @@ static void test_RtlFindClearRuns()
/* Get first 2 */ /* Get first 2 */
ulCount = pRtlFindClearRuns(&bm, runs, 2, FALSE); ulCount = pRtlFindClearRuns(&bm, runs, 2, FALSE);
ok (runs[0].StartOfRun == 7 || runs[0].StartOfRun == 101,"bad find\n"); ok (runs[0].StartingIndex == 7 || runs[0].StartingIndex == 101,"bad find\n");
ok (runs[1].StartOfRun == 7 || runs[1].StartOfRun == 101,"bad find\n"); ok (runs[1].StartingIndex == 7 || runs[1].StartingIndex == 101,"bad find\n");
ok (runs[0].SizeOfRun + runs[1].SizeOfRun == 19 + 3,"bad size\n"); ok (runs[0].NumberOfBits + runs[1].NumberOfBits == 19 + 3,"bad size\n");
ok (runs[0].StartOfRun != runs[1].StartOfRun,"found run twice\n"); ok (runs[0].StartingIndex != runs[1].StartingIndex,"found run twice\n");
ok (runs[2].StartOfRun == 0,"found extra run\n"); ok (runs[2].StartingIndex == 0,"found extra run\n");
/* Get longest 3 */ /* Get longest 3 */
memset(runs, 0, sizeof(runs)); memset(runs, 0, sizeof(runs));
ulCount = pRtlFindClearRuns(&bm, runs, 2, TRUE); ulCount = pRtlFindClearRuns(&bm, runs, 2, TRUE);
ok (runs[0].StartOfRun == 7 || runs[0].StartOfRun == 1877,"bad find\n"); ok (runs[0].StartingIndex == 7 || runs[0].StartingIndex == 1877,"bad find\n");
ok (runs[1].StartOfRun == 7 || runs[1].StartOfRun == 1877,"bad find\n"); ok (runs[1].StartingIndex == 7 || runs[1].StartingIndex == 1877,"bad find\n");
ok (runs[0].SizeOfRun + runs[1].SizeOfRun == 33 + 19,"bad size\n"); ok (runs[0].NumberOfBits + runs[1].NumberOfBits == 33 + 19,"bad size\n");
ok (runs[0].StartOfRun != runs[1].StartOfRun,"found run twice\n"); ok (runs[0].StartingIndex != runs[1].StartingIndex,"found run twice\n");
ok (runs[2].StartOfRun == 0,"found extra run\n"); ok (runs[2].StartingIndex == 0,"found extra run\n");
/* Get all 3 */ /* Get all 3 */
memset(runs, 0, sizeof(runs)); memset(runs, 0, sizeof(runs));
ulCount = pRtlFindClearRuns(&bm, runs, 3, TRUE); ulCount = pRtlFindClearRuns(&bm, runs, 3, TRUE);
ok (runs[0].StartOfRun == 7 || runs[0].StartOfRun == 101 || ok (runs[0].StartingIndex == 7 || runs[0].StartingIndex == 101 ||
runs[0].StartOfRun == 1877,"bad find\n"); runs[0].StartingIndex == 1877,"bad find\n");
ok (runs[1].StartOfRun == 7 || runs[1].StartOfRun == 101 || ok (runs[1].StartingIndex == 7 || runs[1].StartingIndex == 101 ||
runs[1].StartOfRun == 1877,"bad find\n"); runs[1].StartingIndex == 1877,"bad find\n");
ok (runs[2].StartOfRun == 7 || runs[2].StartOfRun == 101 || ok (runs[2].StartingIndex == 7 || runs[2].StartingIndex == 101 ||
runs[2].StartOfRun == 1877,"bad find\n"); runs[2].StartingIndex == 1877,"bad find\n");
ok (runs[0].SizeOfRun + runs[1].SizeOfRun ok (runs[0].NumberOfBits + runs[1].NumberOfBits
+ runs[2].SizeOfRun == 19 + 3 + 33,"bad size\n"); + runs[2].NumberOfBits == 19 + 3 + 33,"bad size\n");
ok (runs[0].StartOfRun != runs[1].StartOfRun,"found run twice\n"); ok (runs[0].StartingIndex != runs[1].StartingIndex,"found run twice\n");
ok (runs[1].StartOfRun != runs[2].StartOfRun,"found run twice\n"); ok (runs[1].StartingIndex != runs[2].StartingIndex,"found run twice\n");
ok (runs[3].StartOfRun == 0,"found extra run\n"); ok (runs[3].StartingIndex == 0,"found extra run\n");
if (pRtlFindLongestRunClear) if (pRtlFindLongestRunClear)
{ {

View File

@ -110,7 +110,7 @@ void thread_init(void)
peb.ProcessParameters = &params; peb.ProcessParameters = &params;
peb.TlsBitmap = &tls_bitmap; peb.TlsBitmap = &tls_bitmap;
peb.LdrData = &ldr; peb.LdrData = &ldr;
RtlInitializeBitMap( &tls_bitmap, (BYTE *)peb.TlsBitmapBits, sizeof(peb.TlsBitmapBits) * 8 ); RtlInitializeBitMap( &tls_bitmap, peb.TlsBitmapBits, sizeof(peb.TlsBitmapBits) * 8 );
InitializeListHead( &ldr.InLoadOrderModuleList ); InitializeListHead( &ldr.InLoadOrderModuleList );
InitializeListHead( &ldr.InMemoryOrderModuleList ); InitializeListHead( &ldr.InMemoryOrderModuleList );
InitializeListHead( &ldr.InInitializationOrderModuleList ); InitializeListHead( &ldr.InInitializationOrderModuleList );

View File

@ -83,14 +83,14 @@ typedef struct RTL_DRIVE_LETTER_CURDIR
typedef struct tagRTL_BITMAP { typedef struct tagRTL_BITMAP {
ULONG SizeOfBitMap; /* Number of bits in the bitmap */ ULONG SizeOfBitMap; /* Number of bits in the bitmap */
LPBYTE BitMapBuffer; /* Bitmap data, assumed sized to a DWORD boundary */ PULONG Buffer; /* Bitmap data, assumed sized to a DWORD boundary */
} RTL_BITMAP, *PRTL_BITMAP; } RTL_BITMAP, *PRTL_BITMAP;
typedef const RTL_BITMAP *PCRTL_BITMAP; typedef const RTL_BITMAP *PCRTL_BITMAP;
typedef struct tagRTL_BITMAP_RUN { typedef struct tagRTL_BITMAP_RUN {
ULONG StartOfRun; /* Bit position at which run starts - FIXME: Name? */ ULONG StartingIndex; /* Bit position at which run starts */
ULONG SizeOfRun; /* Size of the run in bits - FIXME: Name? */ ULONG NumberOfBits; /* Size of the run in bits */
} RTL_BITMAP_RUN, *PRTL_BITMAP_RUN; } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
typedef const RTL_BITMAP_RUN *PCRTL_BITMAP_RUN; typedef const RTL_BITMAP_RUN *PCRTL_BITMAP_RUN;
@ -1462,7 +1462,7 @@ void WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
NTSTATUS WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR); NTSTATUS WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR);
NTSTATUS WINAPI RtlInitializeCriticalSection(RTL_CRITICAL_SECTION *); NTSTATUS WINAPI RtlInitializeCriticalSection(RTL_CRITICAL_SECTION *);
NTSTATUS WINAPI RtlInitializeCriticalSectionAndSpinCount(RTL_CRITICAL_SECTION *,DWORD); NTSTATUS WINAPI RtlInitializeCriticalSectionAndSpinCount(RTL_CRITICAL_SECTION *,DWORD);
void WINAPI RtlInitializeBitMap(PRTL_BITMAP,LPBYTE,ULONG); void WINAPI RtlInitializeBitMap(PRTL_BITMAP,PULONG,ULONG);
void WINAPI RtlInitializeResource(LPRTL_RWLOCK); void WINAPI RtlInitializeResource(LPRTL_RWLOCK);
BOOL WINAPI RtlInitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE); BOOL WINAPI RtlInitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
@ -1618,30 +1618,11 @@ extern NTSTATUS wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STR
inline static BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit) inline static BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit)
{ {
if (lpBits && ulBit < lpBits->SizeOfBitMap && if (lpBits && ulBit < lpBits->SizeOfBitMap &&
lpBits->BitMapBuffer[ulBit >> 3] & (1 << (ulBit & 7))) lpBits->Buffer[ulBit >> 5] & (1 << (ulBit & 31)))
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
#define RtlClearAllBits(p) \
do { \
PRTL_BITMAP _p = (p); \
memset(_p->BitMapBuffer,0,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
} while (0)
#define RtlInitializeBitMap(p,b,s) \
do { \
PRTL_BITMAP _p = (p); \
_p->SizeOfBitMap = (s); \
_p->BitMapBuffer = (b); \
} while (0)
#define RtlSetAllBits(p) \
do { \
PRTL_BITMAP _p = (p); \
memset(_p->BitMapBuffer,0xff,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
} while (0)
/* These are implemented as __fastcall, so we can't let Winelib apps link with them */ /* These are implemented as __fastcall, so we can't let Winelib apps link with them */
inline static USHORT RtlUshortByteSwap(USHORT s) inline static USHORT RtlUshortByteSwap(USHORT s)
{ {