📄 string.h
字号:
__asm__ __volatile__ ("1:\n\t" "incl %0\n\t" "cmpb $0,(%0)\n\t" "jne 1b\n" : "=r" (__tmp), "=m" ( *(struct { char __x[0xfffffff]; } *)__dest) : "0" (__tmp), "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src) : "cc");#endif (void) memcpy (__tmp, __src, __srclen); return __dest;}__STRING_INLINE char *__strcat_g (char *__dest, __const char *__src);__STRING_INLINE char *__strcat_g (char *__dest, __const char *__src){ register char *__tmp = __dest - 1; register char __dummy; __asm__ __volatile__ ("1:\n\t" "incl %1\n\t" "cmpb $0,(%1)\n\t" "jne 1b\n" "2:\n\t" "movb (%2),%b0\n\t" "incl %2\n\t" "movb %b0,(%1)\n\t" "incl %1\n\t" "testb %b0,%b0\n\t" "jne 2b\n" : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=m" ( *(struct { char __x[0xfffffff]; } *)__dest) : "1" (__tmp), "2" (__src), "m" ( *(struct { char __x[0xfffffff]; } *)__src) : "memory", "cc"); return __dest;}/* Append no more than N characters from SRC onto DEST. */#define _HAVE_STRING_ARCH_strncat 1#define strncat(dest, src, n) \ (__extension__ ({ char *__dest = (dest); \ __builtin_constant_p (src) && __builtin_constant_p (n) \ ? (strlen (src) < ((size_t) (n)) \ ? strcat (__dest, (src)) \ : (*(char *)__mempcpy (strchr (__dest, '\0'), \ (__const char *) (src), \ (n)) = 0, __dest)) \ : __strncat_g (__dest, (src), (n)); }))__STRING_INLINE char *__strncat_g (char *__dest, __const char __src[], size_t __n);__STRING_INLINE char *__strncat_g (char *__dest, __const char __src[], size_t __n){ register char *__tmp = __dest; register char __dummy;#ifdef __i686__ __asm__ __volatile__ ("repne; scasb\n" "decl %1\n\t" "1:\n\t" "decl %3\n\t" "js 2f\n\t" "movb (%2),%b0\n\t" "movsb\n\t" "testb %b0,%b0\n\t" "jne 1b\n\t" "decl %1\n" "2:\n\t" "movb $0,(%1)" : "=&a" (__dummy), "=&D" (__tmp), "=&S" (__src), "=&c" (__n) : "0" (0), "1" (__tmp), "2" (__src), "3" (__n) : "memory", "cc");#else --__tmp; __asm__ __volatile__ ("1:\n\t" "cmpb $0,1(%1)\n\t" "leal 1(%1),%1\n\t" "jne 1b\n" "2:\n\t" "decl %3\n\t" "js 3f\n\t" "movb (%2),%b0\n\t" "leal 1(%2),%2\n\t" "movb %b0,(%1)\n\t" "leal 1(%1),%1\n\t" "testb %b0,%b0\n\t" "jne 2b\n\t" "decl %1\n" "3:\n\t" "movb $0,(%1)" : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=&r" (__n) : "1" (__tmp), "2" (__src), "3" (__n) : "memory", "cc");#endif return __dest;}/* Compare S1 and S2. */#define _HAVE_STRING_ARCH_strcmp 1#define strcmp(s1, s2) \ (__extension__ (__builtin_constant_p (s1) && __builtin_constant_p (s2) \ && (sizeof ((s1)[0]) != 1 || strlen (s1) >= 4) \ && (sizeof ((s2)[0]) != 1 || strlen (s2) >= 4) \ ? memcmp ((__const char *) (s1), (__const char *) (s2), \ (strlen (s1) < strlen (s2) \ ? strlen (s1) : strlen (s2)) + 1) \ : (__builtin_constant_p (s1) && sizeof ((s1)[0]) == 1 \ && sizeof ((s2)[0]) == 1 && strlen (s1) < 4 \ ? (__builtin_constant_p (s2) && sizeof ((s2)[0]) == 1 \ ? __strcmp_cc ((__const unsigned char *) (s1), \ (__const unsigned char *) (s2), \ strlen (s1)) \ : __strcmp_cg ((__const unsigned char *) (s1), \ (__const unsigned char *) (s2), \ strlen (s1))) \ : (__builtin_constant_p (s2) && sizeof ((s1)[0]) == 1 \ && sizeof ((s2)[0]) == 1 && strlen (s2) < 4 \ ? (__builtin_constant_p (s1) \ ? __strcmp_cc ((__const unsigned char *) (s1), \ (__const unsigned char *) (s2), \ strlen (s2)) \ : __strcmp_gc ((__const unsigned char *) (s1), \ (__const unsigned char *) (s2), \ strlen (s2))) \ : __strcmp_gg ((s1), (s2))))))#define __strcmp_cc(s1, s2, l) \ (__extension__ ({ register int __result = (s1)[0] - (s2)[0]; \ if (l > 0 && __result == 0) \ { \ __result = (s1)[1] - (s2)[1]; \ if (l > 1 && __result == 0) \ { \ __result = (s1)[2] - (s2)[2]; \ if (l > 2 && __result == 0) \ __result = (s1)[3] - (s2)[3]; \ } \ } \ __result; }))#define __strcmp_cg(s1, s2, l1) \ (__extension__ ({ __const unsigned char *__s2 = (s2); \ register int __result = (s1)[0] - __s2[0]; \ if (l1 > 0 && __result == 0) \ { \ __result = (s1)[1] - __s2[1]; \ if (l1 > 1 && __result == 0) \ { \ __result = (s1)[2] - __s2[2]; \ if (l1 > 2 && __result == 0) \ __result = (s1)[3] - __s2[3]; \ } \ } \ __result; }))#define __strcmp_gc(s1, s2, l2) \ (__extension__ ({ __const unsigned char *__s1 = (s1); \ register int __result = __s1[0] - (s2)[0]; \ if (l2 > 0 && __result == 0) \ { \ __result = __s1[1] - (s2)[1]; \ if (l2 > 1 && __result == 0) \ { \ __result = __s1[2] - (s2)[2]; \ if (l2 > 2 && __result == 0) \ __result = __s1[3] - (s2)[3]; \ } \ } \ __result; }))__STRING_INLINE int __strcmp_gg (__const char *__s1, __const char *__s2);__STRING_INLINE int__strcmp_gg (__const char *__s1, __const char *__s2){ register int __res; __asm__ __volatile__ ("1:\n\t" "movb (%1),%b0\n\t" "leal 1(%1),%1\n\t" "cmpb %b0,(%2)\n\t" "jne 2f\n\t" "leal 1(%2),%2\n\t" "testb %b0,%b0\n\t" "jne 1b\n\t" "xorl %0,%0\n\t" "jmp 3f\n" "2:\n\t" "movl $1,%0\n\t" "jb 3f\n\t" "negl %0\n" "3:" : "=q" (__res), "=&r" (__s1), "=&r" (__s2) : "1" (__s1), "2" (__s2), "m" ( *(struct { char __x[0xfffffff]; } *)__s1), "m" ( *(struct { char __x[0xfffffff]; } *)__s2) : "cc"); return __res;}/* Compare N characters of S1 and S2. */#define _HAVE_STRING_ARCH_strncmp 1#define strncmp(s1, s2, n) \ (__extension__ (__builtin_constant_p (s1) && strlen (s1) < ((size_t) (n)) \ ? strcmp ((s1), (s2)) \ : (__builtin_constant_p (s2) && strlen (s2) < ((size_t) (n))\ ? strcmp ((s1), (s2)) \ : __strncmp_g ((s1), (s2), (n)))))__STRING_INLINE int __strncmp_g (__const char *__s1, __const char *__s2, size_t __n);__STRING_INLINE int__strncmp_g (__const char *__s1, __const char *__s2, size_t __n){ register int __res; __asm__ __volatile__ ("1:\n\t" "decl %3\n\t" "js 2f\n\t" "movb (%1),%b0\n\t" "incl %1\n\t" "cmpb %b0,(%2)\n\t" "jne 3f\n\t" "incl %2\n\t" "testb %b0,%b0\n\t" "jne 1b\n" "2:\n\t" "xorl %0,%0\n\t" "jmp 4f\n" "3:\n\t" "movl $1,%0\n\t" "jb 4f\n\t" "negl %0\n" "4:" : "=q" (__res), "=&r" (__s1), "=&r" (__s2), "=&r" (__n) : "1" (__s1), "2" (__s2), "3" (__n), "m" ( *(struct { __extension__ char __x[__n]; } *)__s1), "m" ( *(struct { __extension__ char __x[__n]; } *)__s2) : "cc"); return __res;}/* Find the first occurrence of C in S. */#define _HAVE_STRING_ARCH_strchr 1#define _USE_STRING_ARCH_strchr 1#define strchr(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? ((c) == '\0' \ ? (char *) __rawmemchr ((s), (c)) \ : __strchr_c ((s), ((c) & 0xff) << 8)) \ : __strchr_g ((s), (c))))__STRING_INLINE char *__strchr_c (__const char *__s, int __c);__STRING_INLINE char *__strchr_c (__const char *__s, int __c){ register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("1:\n\t" "movb (%0),%%al\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "leal 1(%0),%0\n\t" "testb %%al,%%al\n\t" "jne 1b\n\t" "xorl %0,%0\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res;}__STRING_INLINE char *__strchr_g (__const char *__s, int __c);__STRING_INLINE char *__strchr_g (__const char *__s, int __c){ register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("movb %%al,%%ah\n" "1:\n\t" "movb (%0),%%al\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "leal 1(%0),%0\n\t" "testb %%al,%%al\n\t" "jne 1b\n\t" "xorl %0,%0\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res;}/* Find the first occurrence of C in S or the final NUL byte. */#define _HAVE_STRING_ARCH_strchrnul 1#define __strchrnul(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? ((c) == '\0' \ ? (char *) __rawmemchr ((s), c) \ : __strchrnul_c ((s), ((c) & 0xff) << 8)) \ : __strchrnul_g ((s), c)))__STRING_INLINE char *__strchrnul_c (__const char *__s, int __c);__STRING_INLINE char *__strchrnul_c (__const char *__s, int __c){ register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("1:\n\t" "movb (%0),%%al\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "leal 1(%0),%0\n\t" "testb %%al,%%al\n\t" "jne 1b\n\t" "decl %0\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res;}__STRING_INLINE char *__strchrnul_g (__const char *__s, int __c);__STRING_INLINE char *__strchrnul_g (__const char *__s, int __c){ register unsigned long int __d0; register char *__res; __asm__ __volatile__ ("movb %%al,%%ah\n" "1:\n\t" "movb (%0),%%al\n\t" "cmpb %%ah,%%al\n\t" "je 2f\n\t" "leal 1(%0),%0\n\t" "testb %%al,%%al\n\t" "jne 1b\n\t" "decl %0\n" "2:" : "=r" (__res), "=&a" (__d0) : "0" (__s), "1" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res;}#ifdef __USE_GNU# define strchrnul(s, c) __strchrnul ((s), (c))#endif#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED/* Find the first occurrence of C in S. This is the BSD name. */# define _HAVE_STRING_ARCH_index 1# define index(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? __strchr_c ((s), ((c) & 0xff) << 8) \ : __strchr_g ((s), (c))))#endif/* Find the last occurrence of C in S. */#define _HAVE_STRING_ARCH_strrchr 1#define strrchr(s, c) \ (__extension__ (__builtin_constant_p (c) \ ? __strrchr_c ((s), ((c) & 0xff) << 8) \ : __strrchr_g ((s), (c))))#ifdef __i686____STRING_INLINE char *__strrchr_c (__const char *__s, int __c);__STRING_INLINE char *__strrchr_c (__const char *__s, int __c){ register unsigned long int __d0, __d1; register char *__res; __asm__ __volatile__ ("cld\n" "1:\n\t" "lodsb\n\t" "cmpb %h2,%b2\n\t" "cmove %1,%0\n\t" "testb %b2,%b2\n\t" "jne 1b" : "=d" (__res), "=&S" (__d0), "=&a" (__d1) : "0" (1), "1" (__s), "2" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res - 1;}__STRING_INLINE char *__strrchr_g (__const char *__s, int __c);__STRING_INLINE char *__strrchr_g (__const char *__s, int __c){ register unsigned long int __d0, __d1; register char *__res; __asm__ __volatile__ ("movb %b2,%h2\n" "cld\n\t" "1:\n\t" "lodsb\n\t" "cmpb %h2,%b2\n\t" "cmove %1,%0\n\t" "testb %b2,%b2\n\t" "jne 1b" : "=d" (__res), "=&S" (__d0), "=&a" (__d1) : "0" (1), "1" (__s), "2" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res - 1;}#else__STRING_INLINE char *__strrchr_c (__const char *__s, int __c);__STRING_INLINE char *__strrchr_c (__const char *__s, int __c){ register unsigned long int __d0, __d1; register char *__res; __asm__ __volatile__ ("cld\n" "1:\n\t" "lodsb\n\t" "cmpb %%ah,%%al\n\t" "jne 2f\n\t" "leal -1(%%esi),%0\n" "2:\n\t" "testb %%al,%%al\n\t" "jne 1b" : "=d" (__res), "=&S" (__d0), "=&a" (__d1) : "0" (0), "1" (__s), "2" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res;}__STRING_INLINE char *__strrchr_g (__const char *__s, int __c);__STRING_INLINE char *__strrchr_g (__const char *__s, int __c){ register unsigned long int __d0, __d1; register char *__res; __asm__ __volatile__ ("movb %%al,%%ah\n" "cld\n\t" "1:\n\t" "lodsb\n\t" "cmpb %%ah,%%al\n\t" "jne 2f\n\t" "leal -1(%%esi),%0\n" "2:\n\t" "testb %%al,%%al\n\t" "jne 1b" : "=r" (__res), "=&S" (__d0), "=&a" (__d1) : "0" (0), "1" (__s), "2" (__c), "m" ( *(struct { char __x[0xfffffff]; } *)__s) : "cc"); return __res;}#endif#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -