diff --git a/reactos/lib/rtl/mem.c b/reactos/lib/rtl/mem.c new file mode 100644 index 00000000000..e5152b5dafd --- /dev/null +++ b/reactos/lib/rtl/mem.c @@ -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 + +#define NDEBUG +#include + + +/* 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 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 */ diff --git a/reactos/lib/rtl/memgen.c b/reactos/lib/rtl/memgen.c new file mode 100644 index 00000000000..a1e2e9c6ae0 --- /dev/null +++ b/reactos/lib/rtl/memgen.c @@ -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 + +#define NDEBUG +#include + +#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 */ diff --git a/reactos/lib/rtl/rtl.rbuild b/reactos/lib/rtl/rtl.rbuild index 3d28108a795..0c8917ea331 100644 --- a/reactos/lib/rtl/rtl.rbuild +++ b/reactos/lib/rtl/rtl.rbuild @@ -40,6 +40,12 @@ tan_asm.s + + + memgen.c + mem.c + + access.c acl.c atom.c