3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: kernel/rtl/mem.c
6 * PURPOSE: Memory functions
7 * PROGRAMMER: David Welch (welch@mcmail.com)
12 /* INCLUDES *****************************************************************/
14 #include <ddk/ntddk.h>
17 /* FUNCTIONS *****************************************************************/
21 RtlCompareMemory(PVOID Source1,
25 * FUNCTION: Compares blocks of memory and returns the number of equal bytes
27 * Source1 = Block to compare
28 * Source2 = Block to compare
29 * Length = Number of bytes to compare
30 * RETURNS: Number of equal bytes
35 for (i=0,total=0;i<Length;i++)
37 if ( ((PUCHAR)Source1)[i] == ((PUCHAR)Source2)[i] )
50 RtlCompareMemoryUlong (
56 * FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
58 * Source = Block to compare
59 * Length = Number of bytes to compare
60 * Value = Value to compare
61 * RETURNS: Number of equal bytes
64 PULONG ptr = (PULONG)Source;
65 ULONG len = Length / sizeof(ULONG);
68 for (i = 0; i < len; i++)
75 return (ULONG)((PCHAR)ptr - (PCHAR)Source);
79 VOID RtlCopyBytes(PVOID Destination,
83 RtlCopyMemory(Destination,Source,Length);
86 VOID RtlCopyMemory(VOID* Destination, CONST VOID* Source, ULONG Length)
88 DPRINT("RtlCopyMemory(Destination %x Source %x Length %d\n",
89 Destination,Source,Length);
90 memcpy(Destination,Source,Length);
91 DPRINT("*Destination %x\n",*(PULONG)Destination);
106 memset(Destination, Fill, Length);
120 PULONG Dest = Destination;
121 ULONG Count = Length / sizeof(ULONG);