1 /* $Id: mem.c,v 1.12 2002/12/08 15:57:39 robd Exp $
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
] )
47 RtlCompareMemoryUlong (
53 * FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
55 * Source = Block to compare
56 * Length = Number of bytes to compare
57 * Value = Value to compare
58 * RETURNS: Number of equal bytes
61 PULONG ptr
= (PULONG
)Source
;
62 ULONG len
= Length
/ sizeof(ULONG
);
65 for (i
= 0; i
< len
; i
++)
72 return (ULONG
)((PCHAR
)ptr
- (PCHAR
)Source
);
76 VOID
RtlCopyBytes(PVOID Destination
,
80 RtlCopyMemory(Destination
,Source
,Length
);
83 VOID
RtlCopyMemory(VOID
* Destination
, CONST VOID
* Source
, ULONG Length
)
85 DPRINT("RtlCopyMemory(Destination %x Source %x Length %d\n",
86 Destination
,Source
,Length
);
87 memcpy(Destination
,Source
,Length
);
88 DPRINT("*Destination %x\n",*(PULONG
)Destination
);
100 memset(Destination
, Fill
, Length
);
111 PULONG Dest
= Destination
;
112 ULONG Count
= Length
/ sizeof(ULONG
);