ReactOS 0.4.16-dev-340-g0540c21
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 */
37RtlCompareMemory(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 */
64{
66 ULONG_PTR len = Length / sizeof(ULONG);
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 */
85VOID
89 UCHAR Fill)
90{
92}
93
94
95#ifndef _M_AMD64
96/*
97 * @implemented
98 */
99VOID
100NTAPI
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
117VOID
118NTAPI
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 // _WIN64
135#endif // _M_AMD64
136
137#undef RtlMoveMemory
138/*
139 * @implemented
140 */
141VOID
142NTAPI
146{
148}
149
150#undef RtlZeroMemory
151/*
152 * @implemented
153 */
154VOID
155NTAPI
158{
160}
161
162/* EOF */
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:107
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
GLenum GLsizei len
Definition: glext.h:6722
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
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
#define RtlFillMemoryUlong(dst, len, val)
Definition: mkhive.h:55
#define PCHAR
Definition: match.c:90
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static PVOID ptr
Definition: dispmode.c:27
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3016
int Count
Definition: noreturn.cpp:7
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:391
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define CONST
Definition: pedump.c:81
#define memset(x, y, z)
Definition: compat.h:39
SIZE_T NTAPI RtlCompareMemoryUlong(IN PVOID Source, IN SIZE_T Length, IN ULONG Value)
Definition: mem.c:61
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
NTSYSAPI VOID NTAPI RtlFillMemoryUlonglong(_Out_writes_bytes_all_(Length) PVOID Destination, _In_ SIZE_T Length, _In_ ULONGLONG Pattern)
unsigned char UCHAR
Definition: xmlstorage.h:181