Back to index

glibc  2.9
Functions
strlen.c File Reference
#include <string.h>

Go to the source code of this file.

Functions

size_t strlen (const char *str)

Function Documentation

size_t strlen ( const char *  str)

Definition at line 24 of file strlen.c.

{
  int cnt;

  asm("cld\n"               /* Search forward.  */
      /* Some old versions of gas need `repne' instead of `repnz'.  */
      "repnz\n"                    /* Look for a zero byte.  */
      "scasb" /* %0, %1, %3 */ :
      "=c" (cnt) : "D" (str), "0" (-1), "a" (0));

  return -2 - cnt;
}