mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
[RTL]: Rtl ByteSwap functions should use intrinsics, isntead of assembly code. This should be merged into trunk!
svn path=/branches/cmake-bringup/; revision=48425
This commit is contained in:
parent
3c0baef393
commit
044e663dad
2 changed files with 34 additions and 53 deletions
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS Run-Time Library
|
|
||||||
* PURPOSE: Byte swap functions
|
|
||||||
* FILE: lib/rtl/i386/rtlswap.S
|
|
||||||
* PROGRAMER: Alex Ionescu (alex.ionescu@reactos.org)
|
|
||||||
*/
|
|
||||||
|
|
||||||
.intel_syntax noprefix
|
|
||||||
|
|
||||||
.globl @RtlUshortByteSwap@4
|
|
||||||
.globl @RtlUlongByteSwap@4
|
|
||||||
.globl @RtlUlonglongByteSwap@8
|
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
|
||||||
|
|
||||||
.func @RtlUshortByteSwap@4, @RtlUshortByteSwap@4
|
|
||||||
@RtlUshortByteSwap@4:
|
|
||||||
|
|
||||||
/* Swap high and low bits */
|
|
||||||
mov ah, cl
|
|
||||||
mov al, ch
|
|
||||||
ret
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func @RtlUlongByteSwap@4, @RtlUlongByteSwap@4
|
|
||||||
@RtlUlongByteSwap@4:
|
|
||||||
|
|
||||||
/* Swap high and low bits */
|
|
||||||
mov eax, ecx
|
|
||||||
bswap eax
|
|
||||||
ret
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func @RtlUlonglongByteSwap@8, @RtlUlonglongByteSwap@8
|
|
||||||
@RtlUlonglongByteSwap@8:
|
|
||||||
|
|
||||||
/* Get 64-bit integer */
|
|
||||||
mov edx, [esp+8]
|
|
||||||
mov eax, [esp+4]
|
|
||||||
|
|
||||||
/* Swap it */
|
|
||||||
bswap edx
|
|
||||||
bswap eax
|
|
||||||
|
|
||||||
/* Return it */
|
|
||||||
mov ecx, eax
|
|
||||||
mov eax, edx
|
|
||||||
mov edx, ecx
|
|
||||||
ret
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,40 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
#undef RtlUlonglongByteSwap
|
||||||
|
#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
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue