home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / STR / BCMP.S < prev    next >
Encoding:
Text File  |  1993-01-02  |  766 b   |  36 lines

  1. / bcmp.s (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes
  2.  
  3.         .globl _bcmp
  4.  
  5. / int bcmp (const void *s1, const void *s2, size_t n)
  6. / {
  7. /   size_t i;
  8. /
  9. /   for (i = 0; i < n; ++i)
  10. /     if (s1[i] != s2[i])
  11. /       return (1);
  12. /   return (0);
  13. / }
  14.  
  15. / assumes ds=es!
  16.  
  17.         .text
  18.  
  19.         .align  2, 0x90
  20.  
  21. _bcmp:
  22.         pushl   %esi
  23.         pushl   %edi
  24.         movl    3*4(%esp), %edi         / s1
  25.         movl    4*4(%esp), %esi         / s2
  26.         movl    5*4(%esp), %ecx         / n
  27.         xorl    %eax, %eax
  28.         jecxz   1f                      / return (0)
  29.         repe
  30.         cmpsb
  31.         je      1f
  32.         incl    %eax                    / return (1)
  33. 1:      popl    %edi
  34.         popl    %esi
  35.         ret
  36.