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

  1. / strlen.s (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes
  2.  
  3.         .globl _strlen
  4.  
  5. / size_t strlen (const char *string)
  6. / {
  7. /   size_t i;
  8. /   i = 0;
  9. /   while (string[i] != 0) ++i;
  10. /   return (i);
  11. / }
  12.  
  13. / assumes ds=es!
  14.  
  15.         .text
  16.  
  17.         .align  2, 0x90
  18.  
  19. _strlen:
  20.         pushl   %edi
  21.         movl    2*4(%esp), %edi         / string
  22.         movl    $-1, %ecx
  23.         xorb    %al, %al
  24.         repne
  25.         scasb
  26.         movl    $-2, %eax
  27.         subl    %ecx, %eax
  28.         popl    %edi
  29.         ret
  30.