mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[RTL]
Fix a bug in RtlNumberOfSetBits svn path=/trunk/; revision=56793
This commit is contained in:
parent
8e9219216a
commit
b6b380a67b
1 changed files with 6 additions and 4 deletions
|
@ -410,16 +410,18 @@ RtlNumberOfSetBits(
|
||||||
IN PRTL_BITMAP BitMapHeader)
|
IN PRTL_BITMAP BitMapHeader)
|
||||||
{
|
{
|
||||||
PUCHAR Byte, MaxByte;
|
PUCHAR Byte, MaxByte;
|
||||||
ULONG BitCount = 0;
|
ULONG BitCount = 0, Shift;
|
||||||
|
|
||||||
Byte = (PUCHAR)BitMapHeader->Buffer;
|
Byte = (PUCHAR)BitMapHeader->Buffer;
|
||||||
MaxByte = Byte + (BitMapHeader->SizeOfBitMap + 7) / 8;
|
MaxByte = Byte + BitMapHeader->SizeOfBitMap / 8;
|
||||||
|
|
||||||
do
|
while (Byte < MaxByte);
|
||||||
{
|
{
|
||||||
BitCount += BitCountTable[*Byte++];
|
BitCount += BitCountTable[*Byte++];
|
||||||
}
|
}
|
||||||
while (Byte <= MaxByte);
|
|
||||||
|
Shift = 8 - (BitMapHeader->SizeOfBitMap & 7);
|
||||||
|
BitCount += BitCountTable[(*Byte) << Shift];
|
||||||
|
|
||||||
return BitCount;
|
return BitCount;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue