Author: tkreuzer Date: Sun May 5 09:02:36 2013 New Revision: 58936
URL: http://svn.reactos.org/svn/reactos?rev=58936&view=rev Log: {RTL] - Implement RtlFillMemoryUlonglong - Add missing bitmap64.c - Fix 64bit bitmap code
Added: trunk/reactos/lib/rtl/bitmap64.c (with props) Modified: trunk/reactos/lib/rtl/bitmap.c trunk/reactos/lib/rtl/mem.c
Modified: trunk/reactos/lib/rtl/bitmap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=58936&... ============================================================================== --- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Sun May 5 09:02:36 2013 @@ -20,6 +20,7 @@
#ifdef USE_RTL_BITMAP64 #define _BITCOUNT 64 +#define MAXINDEX 0xFFFFFFFFFFFFFFFF typedef ULONG64 BITMAP_INDEX, *PBITMAP_INDEX; typedef ULONG64 BITMAP_BUFFER, *PBITMAP_BUFFER; #define RTL_BITMAP RTL_BITMAP64 @@ -55,6 +56,7 @@ #define RtlFindLongestRunSet RtlFindLongestRunSet64 #else #define _BITCOUNT 32 +#define MAXINDEX 0xFFFFFFFF typedef ULONG BITMAP_INDEX, *PBITMAP_INDEX; typedef ULONG BITMAP_BUFFER, *PBITMAP_BUFFER; #endif @@ -312,8 +314,8 @@ /* Are we unaligned? */ if (Bits) { - /* Create an inverse mask by shifting MAXULONG */ - Mask = MAXULONG << Bits; + /* Create an inverse mask by shifting MAXINDEX */ + Mask = MAXINDEX << Bits;
/* This is what's left in the first ULONG */ Bits = _BITCOUNT - Bits; @@ -346,7 +348,7 @@
/* Clear what's left */ NumberToClear &= (_BITCOUNT - 1); - Mask = MAXULONG << NumberToClear; + Mask = MAXINDEX << NumberToClear; *Buffer &= Mask; }
@@ -369,8 +371,8 @@ /* Are we unaligned? */ if (Bits) { - /* Create a mask by shifting MAXULONG */ - Mask = MAXULONG << Bits; + /* Create a mask by shifting MAXINDEX */ + Mask = MAXINDEX << Bits;
/* This is what's left in the first ULONG */ Bits = _BITCOUNT - Bits; @@ -398,12 +400,12 @@ }
/* Set all full ULONGs */ - RtlFillMemoryUlong(Buffer, NumberToSet >> 3, MAXULONG); + RtlFillMemoryUlong(Buffer, NumberToSet >> 3, MAXINDEX); Buffer += NumberToSet / _BITCOUNT;
/* Set what's left */ NumberToSet &= (_BITCOUNT - 1); - Mask = MAXULONG << NumberToSet; + Mask = MAXINDEX << NumberToSet; *Buffer |= ~Mask; }
@@ -491,7 +493,7 @@ /* Check for valid parameters */ if (!BitMapHeader || NumberToFind > BitMapHeader->SizeOfBitMap) { - return MAXULONG; + return MAXINDEX; }
/* Check if the hint is outside the bitmap */ @@ -517,7 +519,7 @@ /* Search for the next clear run, by skipping a set run */ CurrentBit += RtlpGetLengthOfRunSet(BitMapHeader, CurrentBit, - MAXULONG); + MAXINDEX);
/* Get length of the clear bit run */ CurrentLength = RtlpGetLengthOfRunClear(BitMapHeader, @@ -544,7 +546,7 @@ }
/* Nothing found */ - return MAXULONG; + return MAXINDEX; }
BITMAP_INDEX @@ -559,7 +561,7 @@ /* Check for valid parameters */ if (!BitMapHeader || NumberToFind > BitMapHeader->SizeOfBitMap) { - return MAXULONG; + return MAXINDEX; }
/* Check if the hint is outside the bitmap */ @@ -585,7 +587,7 @@ /* Search for the next set run, by skipping a clear run */ CurrentBit += RtlpGetLengthOfRunClear(BitMapHeader, CurrentBit, - MAXULONG); + MAXINDEX);
/* Get length of the set bit run */ CurrentLength = RtlpGetLengthOfRunSet(BitMapHeader, @@ -612,7 +614,7 @@ }
/* Nothing found */ - return MAXULONG; + return MAXINDEX; }
BITMAP_INDEX @@ -628,7 +630,7 @@ Position = RtlFindClearBits(BitMapHeader, NumberToFind, HintIndex);
/* Did we get something? */ - if (Position != MAXULONG) + if (Position != MAXINDEX) { /* Yes, set the bits */ RtlSetBits(BitMapHeader, Position, NumberToFind); @@ -651,7 +653,7 @@ Position = RtlFindSetBits(BitMapHeader, NumberToFind, HintIndex);
/* Did we get something? */ - if (Position != MAXULONG) + if (Position != MAXINDEX) { /* Yes, clear the bits */ RtlClearBits(BitMapHeader, Position, NumberToFind); @@ -678,11 +680,11 @@ }
/* Assume a set run first, count it's length */ - Length = RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXULONG); + Length = RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXINDEX); *StartingRunIndex = FromIndex + Length;
/* Now return the length of the run */ - return RtlpGetLengthOfRunClear(BitMapHeader, FromIndex + Length, MAXULONG); + return RtlpGetLengthOfRunClear(BitMapHeader, FromIndex + Length, MAXINDEX); }
BITMAP_INDEX @@ -702,11 +704,11 @@ }
/* Assume a clear run first, count it's length */ - Length = RtlpGetLengthOfRunClear(BitMapHeader, FromIndex, MAXULONG); + Length = RtlpGetLengthOfRunClear(BitMapHeader, FromIndex, MAXINDEX); *StartingRunIndex = FromIndex + Length;
/* Now return the length of the run */ - return RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXULONG); + return RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXINDEX); }
BITMAP_INDEX
Added: trunk/reactos/lib/rtl/bitmap64.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap64.c?rev=5893... ============================================================================== --- trunk/reactos/lib/rtl/bitmap64.c (added) +++ trunk/reactos/lib/rtl/bitmap64.c [iso-8859-1] Sun May 5 09:02:36 2013 @@ -0,0 +1,4 @@ + +#define USE_RTL_BITMAP64 + +#include "bitmap.c"
Propchange: trunk/reactos/lib/rtl/bitmap64.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/lib/rtl/mem.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/mem.c?rev=58936&... ============================================================================== --- trunk/reactos/lib/rtl/mem.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/mem.c [iso-8859-1] Sun May 5 09:02:36 2013 @@ -112,6 +112,25 @@ } }
+#ifdef _WIN64 +VOID +NTAPI +RtlFillMemoryUlonglong( + PVOID Destination, + SIZE_T Length, + ULONGLONG Fill) +{ + PULONGLONG Dest = Destination; + SIZE_T Count = Length / sizeof(ULONGLONG); + + while (Count > 0) + { + *Dest = Fill; + Dest++; + Count--; + } +} +#endif
#undef RtlMoveMemory /*