mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 04:37:15 +00:00
restore files mem.c and memgen.c
restore no i386 arch define in rbuild do not remove it, it is for build on no i386 platform the was accident delete in r23830 svn path=/trunk/; revision=24272
This commit is contained in:
parent
56c76b3069
commit
b3f30cb100
3 changed files with 256 additions and 0 deletions
173
reactos/lib/rtl/mem.c
Normal file
173
reactos/lib/rtl/mem.c
Normal file
|
@ -0,0 +1,173 @@
|
|||
/* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/rtl/mem.c
|
||||
* PURPOSE: Memory functions
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <rtl.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* RtlCompareMemory [NTDLL.@]
|
||||
*
|
||||
* Compare one block of memory with another
|
||||
*
|
||||
* PARAMS
|
||||
* Source1 [I] Source block
|
||||
* Source2 [I] Block to compare to Source1
|
||||
* Length [I] Number of bytes to fill
|
||||
*
|
||||
* RETURNS
|
||||
* The length of the first byte at which Source1 and Source2 differ, or Length
|
||||
* if they are the same.
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
SIZE_T NTAPI
|
||||
RtlCompareMemory(IN const VOID *Source1,
|
||||
IN const VOID *Source2,
|
||||
IN SIZE_T Length)
|
||||
{
|
||||
SIZE_T i;
|
||||
for(i=0; (i<Length) && (((PUCHAR)Source1)[i]==((PUCHAR)Source2)[i]); i++)
|
||||
;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
ULONG
|
||||
NTAPI
|
||||
RtlCompareMemoryUlong (
|
||||
PVOID Source,
|
||||
ULONG Length,
|
||||
ULONG Value
|
||||
)
|
||||
/*
|
||||
* FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
|
||||
* ARGUMENTS:
|
||||
* Source = Block to compare
|
||||
* Length = Number of bytes to compare
|
||||
* Value = Value to compare
|
||||
* RETURNS: Number of equal bytes
|
||||
*/
|
||||
{
|
||||
PULONG ptr = (PULONG)Source;
|
||||
ULONG len = Length / sizeof(ULONG);
|
||||
ULONG i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (*ptr != Value)
|
||||
break;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return (ULONG)((PCHAR)ptr - (PCHAR)Source);
|
||||
}
|
||||
|
||||
|
||||
#undef RtlFillMemory
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
RtlFillMemory (
|
||||
PVOID Destination,
|
||||
ULONG Length,
|
||||
UCHAR Fill
|
||||
)
|
||||
{
|
||||
memset(Destination, Fill, Length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
RtlFillMemoryUlong (
|
||||
PVOID Destination,
|
||||
ULONG Length,
|
||||
ULONG Fill
|
||||
)
|
||||
{
|
||||
PULONG Dest = Destination;
|
||||
ULONG Count = Length / sizeof(ULONG);
|
||||
|
||||
while (Count > 0)
|
||||
{
|
||||
*Dest = Fill;
|
||||
Dest++;
|
||||
Count--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#undef RtlMoveMemory
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
RtlMoveMemory (
|
||||
PVOID Destination,
|
||||
CONST VOID * Source,
|
||||
ULONG Length
|
||||
)
|
||||
{
|
||||
memmove (
|
||||
Destination,
|
||||
Source,
|
||||
Length
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
FASTCALL
|
||||
RtlPrefetchMemoryNonTemporal(
|
||||
IN PVOID Source,
|
||||
IN SIZE_T Length
|
||||
)
|
||||
{
|
||||
/* By nature of prefetch, this is non-portable. */
|
||||
(void)Source;
|
||||
(void)Length;
|
||||
}
|
||||
|
||||
|
||||
#undef RtlZeroMemory
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
RtlZeroMemory (
|
||||
PVOID Destination,
|
||||
ULONG Length
|
||||
)
|
||||
{
|
||||
RtlFillMemory (
|
||||
Destination,
|
||||
Length,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
/* EOF */
|
77
reactos/lib/rtl/memgen.c
Normal file
77
reactos/lib/rtl/memgen.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
/* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/rtl/mem.c
|
||||
* PURPOSE: Memory functions
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <rtl.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#undef RtlUlonglongByteSwap
|
||||
#undef RtlUlongByteSwap
|
||||
#undef RtlUshortByteSwap
|
||||
|
||||
/*************************************************************************
|
||||
* RtlUshortByteSwap
|
||||
*
|
||||
* Swap the bytes of an unsigned short value.
|
||||
*
|
||||
* NOTES
|
||||
* Based on the inline versions in Wine winternl.h
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
USHORT FASTCALL
|
||||
RtlUshortByteSwap (IN USHORT Source)
|
||||
{
|
||||
return (Source >> 8) | (Source << 8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* RtlUlongByteSwap [NTDLL.@]
|
||||
*
|
||||
* Swap the bytes of an unsigned int value.
|
||||
*
|
||||
* NOTES
|
||||
* Based on the inline versions in Wine winternl.h
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
ULONG
|
||||
FASTCALL
|
||||
RtlUlongByteSwap(
|
||||
IN ULONG Source
|
||||
)
|
||||
{
|
||||
return ((ULONG)RtlUshortByteSwap((USHORT)Source) << 16) | RtlUshortByteSwap((USHORT)(Source >> 16));
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* RtlUlonglongByteSwap
|
||||
*
|
||||
* Swap the bytes of an unsigned long long value.
|
||||
*
|
||||
* PARAMS
|
||||
* i [I] Value to swap bytes of
|
||||
*
|
||||
* RETURNS
|
||||
* The value with its bytes swapped.
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
ULONGLONG FASTCALL
|
||||
RtlUlonglongByteSwap (IN ULONGLONG Source)
|
||||
{
|
||||
return ((ULONGLONG) RtlUlongByteSwap (Source) << 32) | RtlUlongByteSwap (Source>>32);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
|
@ -40,6 +40,12 @@
|
|||
<file>tan_asm.s</file>
|
||||
</directory>
|
||||
</if>
|
||||
|
||||
<ifnot property="ARCH" value="i386">
|
||||
<file>memgen.c</file>
|
||||
<file>mem.c</file>
|
||||
</ifnot>
|
||||
|
||||
<file>access.c</file>
|
||||
<file>acl.c</file>
|
||||
<file>atom.c</file>
|
||||
|
|
Loading…
Reference in a new issue