-/* $Id: bitmap.c,v 1.6 2002/11/11 22:53:26 hbirr Exp $
+/* $Id: bitmap.c,v 1.10 2004/08/05 18:17:37 ion Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
#include <ddk/ntddk.h>
+#define NDEBUG
+#include <debug.h>
#define ALIGN(x,align) (((x)+(align)-1) / (align))
+#define MASK(Count, Shift) ((Count) == 32 ? 0xFFFFFFFF : ~(0xFFFFFFFF << (Count)) << (Shift))
+
+/*
+ * @implemented
+ */
VOID
STDCALL
RtlInitializeBitMap (
}
+/*
+ * @implemented
+ */
BOOLEAN
STDCALL
RtlAreBitsClear (
Count = (Length > 32 - Shift) ? 32 - Shift : Length;
/* check dword */
- if (*Ptr++ & (~(0xFFFFFFFF << Count) << Shift))
+ if (*Ptr++ & MASK(Count, Shift))
return FALSE;
Length -= Count;
}
+/*
+ * @implemented
+ */
BOOLEAN
STDCALL
RtlAreBitsSet (
Count = (Length > 32 - Shift) ? 32 - Shift : Length;
/* check dword */
- if (~*Ptr++ & (~(0xFFFFFFFF << Count) << Shift))
+ if (~*Ptr++ & MASK(Count, Shift))
return FALSE;
Length -= Count;
}
+/*
+ * @implemented
+ */
VOID
STDCALL
RtlClearAllBits (
{
memset (BitMapHeader->Buffer,
0x00,
- ALIGN(BitMapHeader->SizeOfBitMap, 32));
+ ALIGN(BitMapHeader->SizeOfBitMap, 8));
}
+/*
+* @unimplemented
+*/
+VOID
+STDCALL
+RtlClearBit (
+ PRTL_BITMAP BitMapHeader,
+ ULONG BitNumber
+ )
+{
+ UNIMPLEMENTED;
+}
+/*
+ * @implemented
+ */
VOID
STDCALL
RtlClearBits (
Count = (NumberToClear > 32 - Shift ) ? 32 - Shift : NumberToClear;
/* adjust dword */
- *Ptr++ &= ~(~(0xFFFFFFFF << Count) << Shift);
+ *Ptr++ &= ~MASK(Count, Shift);
NumberToClear -= Count;
StartingIndex += Count;
}
}
+/*
+ * @implemented
+ */
ULONG
STDCALL
RtlFindClearBits (
}
+/*
+ * @implemented
+ */
ULONG
STDCALL
RtlFindClearBitsAndSet (
}
+/*
+ * @implemented
+ */
ULONG
STDCALL
RtlFindFirstRunClear (
return Count;
}
+/*
+* @unimplemented
+*/
+ULONG
+STDCALL
+RtlFindClearRuns (
+ PRTL_BITMAP BitMapHeader,
+ PRTL_BITMAP_RUN RunArray,
+ ULONG SizeOfRunArray,
+ BOOLEAN LocateLongestRuns
+ )
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+/*
+* @unimplemented
+*/
+ULONG
+STDCALL
+RtlFindLastBackwardRunClear (
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG FromIndex,
+ IN PULONG StartingRunIndex
+ )
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+/*
+* @unimplemented
+*/
+ULONG
+STDCALL
+RtlFindNextForwardRunClear (
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG FromIndex,
+ IN PULONG StartingRunIndex
+ )
+{
+ UNIMPLEMENTED;
+ return 0;
+}
ULONG
STDCALL
}
+/*
+ * @implemented
+ */
ULONG
STDCALL
RtlFindLongestRunClear (
ULONG Max = 0;
ULONG Start;
ULONG Maxstart = 0;
- ULONG Mask = 1;
+ ULONG Mask = 1;
while (Index < Size)
{
}
+/*
+ * @implemented
+ */
ULONG
STDCALL
RtlFindSetBits (
ULONG Index;
ULONG Count;
PULONG Ptr;
- CHAR Mask;
+ ULONG Mask;
if (NumberToFind > Size || NumberToFind == 0)
return (ULONG)-1;
}
+/*
+ * @implemented
+ */
ULONG
STDCALL
RtlFindSetBitsAndClear (
}
+/*
+ * @implemented
+ */
ULONG
STDCALL
RtlNumberOfClearBits (
}
+/*
+ * @implemented
+ */
ULONG
STDCALL
RtlNumberOfSetBits (
}
+/*
+ * @implemented
+ */
VOID
STDCALL
RtlSetAllBits (
{
memset (BitMapHeader->Buffer,
0xFF,
- ALIGN(BitMapHeader->SizeOfBitMap, 32));
+ ALIGN(BitMapHeader->SizeOfBitMap, 8));
}
+/*
+* @unimplemented
+*/
+VOID
+STDCALL
+RtlSetBit (
+ PRTL_BITMAP BitMapHeader,
+ ULONG BitNumber
+ )
+{
+ UNIMPLEMENTED;
+}
+/*
+ * @implemented
+ */
VOID
STDCALL
RtlSetBits (
Count = (NumberToSet > 32 - Shift) ? 32 - Shift : NumberToSet;
/* adjust dword */
- *Ptr++ |= ~(0xFFFFFFFF << Count) << Shift;
+ *Ptr++ |= MASK(Count, Shift);
NumberToSet -= Count;
StartingIndex += Count;
}
}
+/*
+* @unimplemented
+*/
+BOOLEAN
+STDCALL
+RtlTestBit (
+ PRTL_BITMAP BitMapHeader,
+ ULONG BitNumber
+ )
+{
+ UNIMPLEMENTED;
+ return FALSE;
+}
/* EOF */