home *** CD-ROM | disk | FTP | other *** search
- / swab.s (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes
-
- .globl _swab
-
- / void swab (const void *src, void *dst, size_t n)
- / {
- / char *s, *d;
- /
- / if (n & 1) return;
- / while (n > 0)
- / {
- / d[0] = s[1];
- / d[1] = s[0];
- / d += 2; s += 2; n -= 2;
- / }
- / }
-
- / assumes ds=es!
-
- .text
-
- .align 2, 0x90
-
- _swab:
- pushl %esi
- pushl %edi
- movl 3*4(%esp), %esi / src
- movl 4*4(%esp), %edi / dst
- movl 5*4(%esp), %ecx / n
- shrl $1, %ecx
- jc 9f
- .align 2, 0x90
- 1: lodsw
- xchgb %al, %ah
- stosw
- loop 1b
- 9: popl %edi
- popl %esi
- ret
-