Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmem.c
Go to the documentation of this file.
00001 /* COPYRIGHT: See COPYING in the top level directory 00002 * PROJECT: ReactOS system libraries 00003 * FILE: lib/rtl/mem.c 00004 * PURPOSE: Memory functions 00005 * PROGRAMMER: David Welch (welch@mcmail.com) 00006 */ 00007 00008 /* INCLUDES *****************************************************************/ 00009 00010 #include <rtl.h> 00011 00012 #define NDEBUG 00013 #include <debug.h> 00014 00015 00016 /* FUNCTIONS *****************************************************************/ 00017 00018 /****************************************************************************** 00019 * RtlCompareMemory [NTDLL.@] 00020 * 00021 * Compare one block of memory with another 00022 * 00023 * PARAMS 00024 * Source1 [I] Source block 00025 * Source2 [I] Block to compare to Source1 00026 * Length [I] Number of bytes to fill 00027 * 00028 * RETURNS 00029 * The length of the first byte at which Source1 and Source2 differ, or Length 00030 * if they are the same. 00031 * 00032 * @implemented 00033 */ 00034 SIZE_T NTAPI 00035 RtlCompareMemory(IN const VOID *Source1, 00036 IN const VOID *Source2, 00037 IN SIZE_T Length) 00038 { 00039 SIZE_T i; 00040 for(i=0; (i<Length) && (((PUCHAR)Source1)[i]==((PUCHAR)Source2)[i]); i++) 00041 ; 00042 return i; 00043 } 00044 00045 00046 /* 00047 * @implemented 00048 */ 00049 SIZE_T 00050 NTAPI 00051 RtlCompareMemoryUlong ( 00052 PVOID Source, 00053 SIZE_T Length, 00054 ULONG Value 00055 ) 00056 /* 00057 * FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes 00058 * ARGUMENTS: 00059 * Source = Block to compare 00060 * Length = Number of bytes to compare 00061 * Value = Value to compare 00062 * RETURNS: Number of equal bytes 00063 */ 00064 { 00065 PULONG ptr = (PULONG)Source; 00066 ULONG_PTR len = Length / sizeof(ULONG); 00067 ULONG_PTR i; 00068 00069 for (i = 0; i < len; i++) 00070 { 00071 if (*ptr != Value) 00072 break; 00073 ptr++; 00074 } 00075 00076 return (SIZE_T)((PCHAR)ptr - (PCHAR)Source); 00077 } 00078 00079 00080 #undef RtlFillMemory 00081 /* 00082 * @implemented 00083 */ 00084 VOID 00085 NTAPI 00086 RtlFillMemory ( 00087 PVOID Destination, 00088 SIZE_T Length, 00089 UCHAR Fill 00090 ) 00091 { 00092 memset(Destination, Fill, Length); 00093 } 00094 00095 00096 00097 /* 00098 * @implemented 00099 */ 00100 VOID 00101 NTAPI 00102 RtlFillMemoryUlong ( 00103 PVOID Destination, 00104 SIZE_T Length, 00105 ULONG Fill 00106 ) 00107 { 00108 PULONG Dest = Destination; 00109 SIZE_T Count = Length / sizeof(ULONG); 00110 00111 while (Count > 0) 00112 { 00113 *Dest = Fill; 00114 Dest++; 00115 Count--; 00116 } 00117 } 00118 00119 00120 #undef RtlMoveMemory 00121 /* 00122 * @implemented 00123 */ 00124 VOID 00125 NTAPI 00126 RtlMoveMemory ( 00127 PVOID Destination, 00128 CONST VOID * Source, 00129 SIZE_T Length 00130 ) 00131 { 00132 memmove ( 00133 Destination, 00134 Source, 00135 Length 00136 ); 00137 } 00138 00139 /* 00140 * @implemented 00141 */ 00142 VOID 00143 FASTCALL 00144 RtlPrefetchMemoryNonTemporal( 00145 IN PVOID Source, 00146 IN SIZE_T Length 00147 ) 00148 { 00149 /* By nature of prefetch, this is non-portable. */ 00150 (void)Source; 00151 (void)Length; 00152 } 00153 00154 00155 #undef RtlZeroMemory 00156 /* 00157 * @implemented 00158 */ 00159 VOID 00160 NTAPI 00161 RtlZeroMemory ( 00162 PVOID Destination, 00163 SIZE_T Length 00164 ) 00165 { 00166 RtlFillMemory ( 00167 Destination, 00168 Length, 00169 0 00170 ); 00171 } 00172 00173 /* EOF */ Generated on Fri May 25 2012 04:34:33 for ReactOS by
1.7.6.1
|