* Bring back rbuild build to be used until bug 6372 is fixed.
[reactos.git] / lib / rtl / i386 / rtlswap.S
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Run-Time Library
4 * PURPOSE: Byte swap functions
5 * FILE: lib/rtl/i386/rtlswap.S
6 * PROGRAMER: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 .intel_syntax noprefix
10
11 .globl @RtlUshortByteSwap@4
12 .globl @RtlUlongByteSwap@4
13 .globl @RtlUlonglongByteSwap@8
14
15 /* FUNCTIONS ***************************************************************/
16
17 .func @RtlUshortByteSwap@4, @RtlUshortByteSwap@4
18 @RtlUshortByteSwap@4:
19
20 /* Swap high and low bits */
21 mov ah, cl
22 mov al, ch
23 ret
24 .endfunc
25
26 .func @RtlUlongByteSwap@4, @RtlUlongByteSwap@4
27 @RtlUlongByteSwap@4:
28
29 /* Swap high and low bits */
30 mov eax, ecx
31 bswap eax
32 ret
33 .endfunc
34
35 .func @RtlUlonglongByteSwap@8, @RtlUlonglongByteSwap@8
36 @RtlUlonglongByteSwap@8:
37
38 /* Get 64-bit integer */
39 mov edx, [esp+8]
40 mov eax, [esp+4]
41
42 /* Swap it */
43 bswap edx
44 bswap eax
45
46 /* Return it */
47 mov ecx, eax
48 mov eax, edx
49 mov edx, ecx
50 ret
51 .endfunc
52
53