mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 05:37:44 +00:00
minor improvements
svn path=/trunk/; revision=810
This commit is contained in:
parent
13436cd7f7
commit
2ea8bb5aa4
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mem.c,v 1.6 1999/11/09 18:03:39 ekohl Exp $
|
/* $Id: mem.c,v 1.7 1999/12/01 15:22:49 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -22,7 +22,11 @@
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
STDCALL
|
STDCALL
|
||||||
RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length)
|
RtlCompareMemory (
|
||||||
|
PVOID Source1,
|
||||||
|
PVOID Source2,
|
||||||
|
ULONG Length
|
||||||
|
)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Compares blocks of memory and returns the number of equal bytes
|
* FUNCTION: Compares blocks of memory and returns the number of equal bytes
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -33,7 +37,7 @@ RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i,total;
|
int i,total;
|
||||||
|
|
||||||
for (i=0,total=0;i<Length;i++)
|
for (i=0,total=0;i<Length;i++)
|
||||||
{
|
{
|
||||||
if ( ((PUCHAR)Source1)[i] == ((PUCHAR)Source2)[i] )
|
if ( ((PUCHAR)Source1)[i] == ((PUCHAR)Source2)[i] )
|
||||||
|
@ -44,12 +48,46 @@ RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length)
|
||||||
return(total);
|
return(total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
STDCALL
|
||||||
|
RtlCompareMemoryUlong (
|
||||||
|
PVOID Source,
|
||||||
|
ULONG Length,
|
||||||
|
ULONG Value
|
||||||
|
)
|
||||||
|
/*
|
||||||
|
* FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
|
||||||
|
* ARGUMENTS:
|
||||||
|
* Source = Block to compare
|
||||||
|
* Length = Number of bytes to compare
|
||||||
|
* Value = Value to compare
|
||||||
|
* RETURNS: Number of equal bytes
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
PULONG ptr = (PULONG)Source;
|
||||||
|
ULONG len = Length / sizeof(ULONG);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
if (*ptr != Value)
|
||||||
|
break;
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (ULONG)((PCHAR)ptr - (PCHAR)Source);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
VOID RtlCopyBytes(PVOID Destination,
|
VOID RtlCopyBytes(PVOID Destination,
|
||||||
CONST VOID* Source,
|
CONST VOID* Source,
|
||||||
ULONG Length)
|
ULONG Length)
|
||||||
{
|
{
|
||||||
RtlCopyMemory(Destination,Source,Length);
|
RtlCopyMemory(Destination,Source,Length);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
VOID RtlCopyMemory(VOID* Destination, CONST VOID* Source, ULONG Length)
|
VOID RtlCopyMemory(VOID* Destination, CONST VOID* Source, ULONG Length)
|
||||||
{
|
{
|
||||||
|
@ -75,35 +113,20 @@ RtlFillMemory (
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
RtlFillMemoryUlong (
|
RtlFillMemoryUlong (
|
||||||
PVOID Destination,
|
|
||||||
ULONG Length,
|
|
||||||
ULONG Fill
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PULONG Dest = Destination;
|
|
||||||
ULONG Count = Length / 4;
|
|
||||||
|
|
||||||
while (Count > 0)
|
|
||||||
{
|
|
||||||
*Dest = Fill;
|
|
||||||
Dest++;
|
|
||||||
Count--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
|
||||||
STDCALL
|
|
||||||
RtlZeroMemory (
|
|
||||||
PVOID Destination,
|
PVOID Destination,
|
||||||
ULONG Length
|
ULONG Length,
|
||||||
|
ULONG Fill
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
RtlFillMemory (
|
PULONG Dest = Destination;
|
||||||
Destination,
|
ULONG Count = Length / sizeof(ULONG);
|
||||||
Length,
|
|
||||||
0
|
while (Count > 0)
|
||||||
);
|
{
|
||||||
|
*Dest = Fill;
|
||||||
|
Dest++;
|
||||||
|
Count--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,4 +146,18 @@ RtlMoveMemory (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
STDCALL
|
||||||
|
RtlZeroMemory (
|
||||||
|
PVOID Destination,
|
||||||
|
ULONG Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RtlFillMemory (
|
||||||
|
Destination,
|
||||||
|
Length,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue