ReactOS  0.4.14-dev-376-gaedba84
mem.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS system libraries
4  * FILE: lib/rtl/mem.c
5  * PURPOSE: Memory functions
6  * PROGRAMMER: David Welch (welch@mcmail.com)
7  */
8 
9 /* INCLUDES *****************************************************************/
10 
11 #include <rtl.h>
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 
17 /* FUNCTIONS *****************************************************************/
18 
19 /******************************************************************************
20  * RtlCompareMemory [NTDLL.@]
21  *
22  * Compare one block of memory with another
23  *
24  * PARAMS
25  * Source1 [I] Source block
26  * Source2 [I] Block to compare to Source1
27  * Length [I] Number of bytes to fill
28  *
29  * RETURNS
30  * The length of the first byte at which Source1 and Source2 differ, or Length
31  * if they are the same.
32  *
33  * @implemented
34  */
35 SIZE_T
36 NTAPI
37 RtlCompareMemory(IN const VOID *Source1,
38  IN const VOID *Source2,
40 {
41  SIZE_T i;
42  for (i = 0; (i < Length) && (((PUCHAR)Source1)[i] == ((PUCHAR)Source2)[i]); i++)
43  ;
44 
45  return i;
46 }
47 
48 
49 /*
50  * FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
51  * ARGUMENTS:
52  * Source = Block to compare
53  * Length = Number of bytes to compare
54  * Value = Value to compare
55  * RETURNS: Number of equal bytes
56  *
57  * @implemented
58  */
59 SIZE_T
60 NTAPI
63  IN ULONG Value)
64 {
66  ULONG_PTR len = Length / sizeof(ULONG);
67  ULONG_PTR i;
68 
69  for (i = 0; i < len; i++)
70  {
71  if (*ptr != Value)
72  break;
73 
74  ptr++;
75  }
76 
77  return (SIZE_T)((PCHAR)ptr - (PCHAR)Source);
78 }
79 
80 
81 #undef RtlFillMemory
82 /*
83  * @implemented
84  */
85 VOID
86 NTAPI
88  SIZE_T Length,
89  UCHAR Fill)
90 {
92 }
93 
94 
95 
96 /*
97  * @implemented
98  */
99 VOID
100 NTAPI
102  SIZE_T Length,
103  ULONG Fill)
104 {
105  PULONG Dest = Destination;
106  SIZE_T Count = Length / sizeof(ULONG);
107 
108  while (Count > 0)
109  {
110  *Dest = Fill;
111  Dest++;
112  Count--;
113  }
114 }
115 
116 #ifdef _WIN64
117 VOID
118 NTAPI
121  SIZE_T Length,
122  ULONGLONG Fill)
123 {
124  PULONGLONG Dest = Destination;
125  SIZE_T Count = Length / sizeof(ULONGLONG);
126 
127  while (Count > 0)
128  {
129  *Dest = Fill;
130  Dest++;
131  Count--;
132  }
133 }
134 #endif
135 
136 #undef RtlMoveMemory
137 /*
138  * @implemented
139  */
140 VOID
141 NTAPI
143  CONST VOID *Source,
144  SIZE_T Length)
145 {
147 }
148 
149 #undef RtlZeroMemory
150 /*
151  * @implemented
152  */
153 VOID
154 NTAPI
156  SIZE_T Length)
157 {
159 }
160 
161 /* EOF */
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
signed char * PCHAR
Definition: retypes.h:7
#define IN
Definition: typedefs.h:38
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
VOID NTAPI RtlZeroMemory(PVOID Destination, SIZE_T Length)
Definition: mem.c:155
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
unsigned char * PUCHAR
Definition: retypes.h:3
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
static PVOID ptr
Definition: dispmode.c:27
#define PCHAR
Definition: match.c:90
uint64_t ULONGLONG
Definition: typedefs.h:65
VOID NTAPI RtlFillMemoryUlong(PVOID Destination, SIZE_T Length, ULONG Fill)
Definition: mem.c:101
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2891
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI RtlFillMemory(PVOID Destination, SIZE_T Length, UCHAR Fill)
Definition: mem.c:87
SIZE_T NTAPI RtlCompareMemory(IN const VOID *Source1, IN const VOID *Source2, IN SIZE_T Length)
Definition: mem.c:37
GLenum GLsizei len
Definition: glext.h:6722
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned int * PULONG
Definition: retypes.h:1
SIZE_T NTAPI RtlCompareMemoryUlong(IN PVOID Source, IN SIZE_T Length, IN ULONG Value)
Definition: mem.c:61
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:390
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
#define memset(x, y, z)
Definition: compat.h:39
VOID NTAPI RtlMoveMemory(PVOID Destination, CONST VOID *Source, SIZE_T Length)
Definition: mem.c:142
#define CONST
Definition: pedump.c:81
NTSYSAPI VOID NTAPI RtlFillMemoryUlonglong(_Out_writes_bytes_all_(Length) PVOID Destination, _In_ SIZE_T Length, _In_ ULONGLONG Pattern)