Author: tkreuzer
Date: Sun May 25 10:36:47 2014
New Revision: 63437
URL:
http://svn.reactos.org/svn/reactos?rev=63437&view=rev
Log:
[RTL]
Fix warnings and a bug in 64bit bitmap code
Modified:
trunk/reactos/lib/rtl/bitmap.c
Modified: trunk/reactos/lib/rtl/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=63437…
==============================================================================
--- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Sun May 25 10:36:47 2014
@@ -30,6 +30,9 @@
#undef BitScanForward
#define BitScanForward(Index, Mask) \
do { unsigned long tmp; BitScanForward64(&tmp, Mask); *Index = tmp; } while (0)
+#undef BitScanReverse
+#define BitScanReverse(Index, Mask) \
+ do { unsigned long tmp; BitScanReverse64(&tmp, Mask); *Index = tmp; } while (0)
#define RtlFillMemoryUlong RtlFillMemoryUlonglong
#define RtlInitializeBitMap RtlInitializeBitMap64
@@ -734,7 +737,7 @@
return RtlFindNextForwardRunClear(BitMapHeader, 0, StartingIndex);
}
-ULONG
+BITMAP_INDEX
NTAPI
RtlFindLastBackwardRunClear(
_In_ PRTL_BITMAP BitMapHeader,
@@ -771,7 +774,7 @@
BitScanReverse(&BitPos, InvValue);
/* Calculate last bit position */
- FromIndex = (Buffer + 1 - BitMapHeader->Buffer) * _BITCOUNT + BitPos;
+ FromIndex = (BITMAP_INDEX)((Buffer + 1 - BitMapHeader->Buffer) * _BITCOUNT +
BitPos);
Value = ~InvValue << ((_BITCOUNT - 1) - BitPos) >> ((_BITCOUNT - 1) -
BitPos);
@@ -787,7 +790,7 @@
BitScanReverse(&BitPos, Value);
/* Calculate Starting Index */
- *StartingRunIndex = (Buffer + 1 - BitMapHeader->Buffer) * _BITCOUNT + BitPos +
1;
+ *StartingRunIndex = (BITMAP_INDEX)((Buffer + 1 - BitMapHeader->Buffer) *
_BITCOUNT + BitPos + 1);
}
else
{
@@ -796,7 +799,7 @@
}
/* Return length of the run */
- return FromIndex - *StartingRunIndex;
+ return (FromIndex - *StartingRunIndex);
}