- Rename memgen.c to byteswap.c and merge with the implementations from largeint.c, that were using intrinsics
- Fix amd64 build

svn path=/trunk/; revision=53321
This commit is contained in:
Timo Kreuzer 2011-08-19 18:39:47 +00:00
parent c952a3638e
commit 3a2698f9c8
5 changed files with 30 additions and 50 deletions

View file

@ -14,6 +14,7 @@ list(APPEND SOURCE
avltable.c
bitmap.c
bootdata.c
byteswap.c
compress.c
condvar.c
crc32.c
@ -80,13 +81,11 @@ elseif(ARCH MATCHES amd64)
amd64/slist.S
amd64/unwind.c
amd64/stubs.c
mem.c
memgen.c)
mem.c)
elseif(ARCH MATCHES arm)
list(APPEND SOURCE
arm/debug_asm.S
mem.c
memgen.c)
mem.c)
elseif(ARCH MATCHES powerpc)
list(APPEND SOURCE
powerpc/debug.c

View file

@ -26,10 +26,16 @@
*
* @implemented
*/
USHORT FASTCALL
RtlUshortByteSwap (IN USHORT Source)
USHORT
FASTCALL
RtlUshortByteSwap(
IN USHORT Source)
{
return (Source >> 8) | (Source << 8);
#if defined(_M_IX86) || defined(_M_AMD64)
return _byteswap_ushort(Source);
#else
return (Source >> 8) | (Source << 8);
#endif
}
@ -47,10 +53,13 @@ RtlUshortByteSwap (IN USHORT Source)
ULONG
FASTCALL
RtlUlongByteSwap(
IN ULONG Source
)
IN ULONG Source)
{
return ((ULONG)RtlUshortByteSwap((USHORT)Source) << 16) | RtlUshortByteSwap((USHORT)(Source >> 16));
#if defined(_M_IX86) || defined(_M_AMD64)
return _byteswap_ulong(Source);
#else
return ((ULONG)RtlUshortByteSwap((USHORT)Source) << 16) | RtlUshortByteSwap((USHORT)(Source >> 16));
#endif
}
@ -68,9 +77,14 @@ RtlUlongByteSwap(
* @implemented
*/
ULONGLONG FASTCALL
RtlUlonglongByteSwap (IN ULONGLONG Source)
RtlUlonglongByteSwap(
IN ULONGLONG Source)
{
return ((ULONGLONG) RtlUlongByteSwap (Source) << 32) | RtlUlongByteSwap (Source>>32);
#if defined(_M_IX86) || defined(_M_AMD64)
return _byteswap_uint64(Source);
#else
return ((ULONGLONG) RtlUlongByteSwap (Source) << 32) | RtlUlongByteSwap (Source>>32);
#endif
}

View file

@ -80,10 +80,6 @@ UCHAR FillPattern[HEAP_ENTRY_SIZE] =
HEAP_TAIL_FILL
};
ULONG NTAPI
RtlCompareMemoryUlong(PVOID Source, ULONG Length, ULONG Value);
/* FUNCTIONS *****************************************************************/
VOID NTAPI

View file

@ -18,36 +18,7 @@
#undef RtlUlongByteSwap
#undef RtlUshortByteSwap
/*
* @implemented
*/
USHORT
FASTCALL
RtlUshortByteSwap(IN USHORT Source)
{
return _byteswap_ushort(Source);
}
/*
* @implemented
*/
ULONG
FASTCALL
RtlUlongByteSwap(IN ULONG Source)
{
return _byteswap_ulong(Source);
}
/*
* @implemented
*/
ULONGLONG
FASTCALL
RtlUlonglongByteSwap(IN ULONGLONG Source)
{
return _byteswap_uint64(Source);
}
/*
* @implemented
*/

View file

@ -46,11 +46,11 @@ RtlCompareMemory(IN const VOID *Source1,
/*
* @implemented
*/
ULONG
SIZE_T
NTAPI
RtlCompareMemoryUlong (
PVOID Source,
ULONG Length,
SIZE_T Length,
ULONG Value
)
/*
@ -63,8 +63,8 @@ RtlCompareMemoryUlong (
*/
{
PULONG ptr = (PULONG)Source;
ULONG len = Length / sizeof(ULONG);
ULONG i;
ULONG_PTR len = Length / sizeof(ULONG);
ULONG_PTR i;
for (i = 0; i < len; i++)
{
@ -73,7 +73,7 @@ RtlCompareMemoryUlong (
ptr++;
}
return (ULONG)((PCHAR)ptr - (PCHAR)Source);
return (SIZE_T)((PCHAR)ptr - (PCHAR)Source);
}