home *** CD-ROM | disk | FTP | other *** search
- / memdif.s (emx+gcc) -- Copyright (c) 1993 by Eberhard Mattes
-
- .globl __memdif
-
- / size_t _memdif (const void *mem1, const void *mem2, size_t n)
- / {
- / size_t i;
- /
- / for (i = 0; i < n; ++i)
- / {
- / if (((char *)mem1)[i] != ((char *)mem2)[i])
- / return (i);
- / }
- / return (_MEMDIF_EQ);
- / }
-
- / assumes ds=es!
-
- .text
-
- .align 2, 0x90
-
- __memdif:
- pushl %esi
- pushl %edi
- movl 3*4(%esp), %edi / mem1
- movl 4*4(%esp), %esi / mem2
- movl 5*4(%esp), %ecx / n
- xorl %eax, %eax
- jecxz 1f
- repe
- cmpsb
- je 1f
- decl %edi
- subl 3*4(%esp), %edi
- movl %edi, %eax
- jmp 9f
-
- 1: movl $-1, %eax / _MEMDIF_EQ
- 9: popl %edi
- popl %esi
- ret
-