⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.h

📁 它通过提供glibc兼容使得应用程序移植到较小的c 库时相当得容易. 它能够应用到带虚拟存储的Linux和uClinux上.在大多数带MMU部件的平台上为使它更加紧凑,它也能够编译成共享库.uClib
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Compare S1 and S2.  */#define _HAVE_STRING_ARCH_strcmp 1#ifndef _FORCE_INLINES__STRING_INLINE intstrcmp (__const char *__s1, __const char *__s2){  register unsigned long int __d0, __d1;  register int __res;  __asm__ __volatile__    ("cld\n"     "1:\n\t"     "lodsb\n\t"     "scasb\n\t"     "jne	2f\n\t"     "testb	%%al,%%al\n\t"     "jne	1b\n\t"     "xorl	%%eax,%%eax\n\t"     "jmp	3f\n"     "2:\n\t"     "sbbl	%%eax,%%eax\n\t"     "orb	$1,%%al\n"     "3:"     : "=a" (__res), "=&S" (__d0), "=&D" (__d1)     : "1" (__s1), "2" (__s2)     : "cc");  return __res;}#endif/* Compare N characters of S1 and S2.  */#define _HAVE_STRING_ARCH_strncmp 1#ifndef _FORCE_INLINES__STRING_INLINE intstrncmp (__const char *__s1, __const char *__s2, size_t __n){  register unsigned long int __d0, __d1, __d2;  register int __res;  __asm__ __volatile__    ("cld\n"     "1:\n\t"     "decl	%3\n\t"     "js	2f\n\t"     "lodsb\n\t"     "scasb\n\t"     "jne	3f\n\t"     "testb	%%al,%%al\n\t"     "jne	1b\n"     "2:\n\t"     "xorl	%%eax,%%eax\n\t"     "jmp	4f\n"     "3:\n\t"     "sbbl	%%eax,%%eax\n\t"     "orb	$1,%%al\n"     "4:"     : "=a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)     : "1" (__s1), "2" (__s2), "3" (__n)     : "cc");  return __res;}#endif/* 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)				      \		  ? __strchr_c (s, ((c) & 0xff) << 8)			      \		  : __strchr_g (s, c)))__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__    ("cld\n\t"     "movb	%%al,%%ah\n"     "1:\n\t"     "lodsb\n\t"     "cmpb	%%ah,%%al\n\t"     "je	2f\n\t"     "testb	%%al,%%al\n\t"     "jne	1b\n\t"     "movl	$1,%1\n"     "2:\n\t"     "movl	%1,%0"     : "=a" (__res), "=&S" (__d0)     : "0" (__c), "1" (__s)     : "cc");  return __res - 1;}__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__    ("cld\n\t"     "1:\n\t"     "lodsb\n\t"     "cmpb	%%ah,%%al\n\t"     "je	2f\n\t"     "testb	%%al,%%al\n\t"     "jne	1b\n\t"     "movl	$1,%1\n"     "2:\n\t"     "movl	%1,%0"     : "=a" (__res), "=&S" (__d0)     : "0" (__c), "1" (__s)     : "cc");  return __res - 1;}/* 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_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__    ("cld\n\t"     "movb	%%al,%%ah\n"     "1:\n\t"     "lodsb\n\t"     "cmpb	%%ah,%%al\n\t"     "je	2f\n\t"     "testb	%%al,%%al\n\t"     "jne	1b\n\t"     "2:\n\t"     "movl	%1,%0"     : "=a" (__res), "=&S" (__d0)     : "0" (__c), "1" (__s)     : "cc");  return __res - 1;}__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__    ("cld\n\t"     "1:\n\t"     "lodsb\n\t"     "cmpb	%%ah,%%al\n\t"     "je	2f\n\t"     "testb	%%al,%%al\n\t"     "jne	1b\n\t"     "2:\n\t"     "movl	%1,%0"     : "=a" (__res), "=&S" (__d0)     : "0" (__c), "1" (__s)     : "cc");  return __res - 1;}#ifdef __USE_GNU# define strchrnul(s, c) __strchrnul (s, c)#endif/* Return the length of the initial segment of S which   consists entirely of characters not in REJECT.  */#define _HAVE_STRING_ARCH_strcspn 1#ifndef _FORCE_INLINES# ifdef __PIC____STRING_INLINE size_tstrcspn (__const char *__s, __const char *__reject){  register unsigned long int __d0, __d1, __d2;  register char *__res;  __asm__ __volatile__    ("pushl	%%ebx\n\t"     "cld\n\t"     "movl	%4,%%edi\n\t"     "repne; scasb\n\t"     "notl	%%ecx\n\t"     "decl	%%ecx\n\t"     "movl	%%ecx,%%ebx\n"     "1:\n\t"     "lodsb\n\t"     "testb	%%al,%%al\n\t"     "je	2f\n\t"     "movl	%4,%%edi\n\t"     "movl	%%ebx,%%ecx\n\t"     "repne; scasb\n\t"     "jne	1b\n"     "2:\n\t"     "popl	%%ebx"     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)     : "d" (__reject), "0" (__s), "1" (0), "2" (0xffffffff)     : "cc");  return (__res - 1) - __s;}# else__STRING_INLINE size_tstrcspn (__const char *__s, __const char *__reject){  register unsigned long int __d0, __d1, __d2, __d3;  register char *__res;  __asm__ __volatile__    ("cld\n\t"     "movl	%5,%%edi\n\t"     "repne; scasb\n\t"     "notl	%%ecx\n\t"     "decl	%%ecx\n\t"     "movl	%%ecx,%%edx\n"     "1:\n\t"     "lodsb\n\t"     "testb	%%al,%%al\n\t"     "je	2f\n\t"     "movl	%5,%%edi\n\t"     "movl	%%edx,%%ecx\n\t"     "repne; scasb\n\t"     "jne	1b\n"     "2:"     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)     : "g" (__reject), "0" (__s), "1" (0), "2" (0xffffffff)     : "cc");  return (__res - 1) - __s;}# endif#endif/* Return the length of the initial segment of S which   consists entirely of characters in ACCEPT.  */#define _HAVE_STRING_ARCH_strspn 1#ifndef _FORCE_INLINES# ifdef __PIC____STRING_INLINE size_tstrspn (__const char *__s, __const char *__accept){  register unsigned long int __d0, __d1, __d2;  register char *__res;  __asm__ __volatile__    ("pushl	%%ebx\n\t"     "cld\n\t"     "movl	%4,%%edi\n\t"     "repne; scasb\n\t"     "notl	%%ecx\n\t"     "decl	%%ecx\n\t"     "movl	%%ecx,%%ebx\n"     "1:\n\t"     "lodsb\n\t"     "testb	%%al,%%al\n\t"     "je	2f\n\t"     "movl	%4,%%edi\n\t"     "movl	%%ebx,%%ecx\n\t"     "repne; scasb\n\t"     "je	1b\n"     "2:\n\t"     "popl	%%ebx"     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)     : "r" (__accept), "0" (__s), "1" (0), "2" (0xffffffff)     : "cc");  return (__res - 1) - __s;}# else__STRING_INLINE size_tstrspn (__const char *__s, __const char *__accept){  register unsigned long int __d0, __d1, __d2, __d3;  register char *__res;  __asm__ __volatile__    ("cld\n\t"     "movl	%5,%%edi\n\t"     "repne; scasb\n\t"     "notl	%%ecx\n\t"     "decl	%%ecx\n\t"     "movl	%%ecx,%%edx\n"     "1:\n\t"     "lodsb\n\t"     "testb	%%al,%%al\n\t"     "je	2f\n\t"     "movl	%5,%%edi\n\t"     "movl	%%edx,%%ecx\n\t"     "repne; scasb\n\t"     "je	1b\n"     "2:"     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)     : "g" (__accept), "0" (__s), "1" (0), "2" (0xffffffff)     : "cc");  return (__res - 1) - __s;}# endif#endif/* Find the first occurrence in S of any character in ACCEPT.  */#define _HAVE_STRING_ARCH_strpbrk 1#ifndef _FORCE_INLINES# ifdef __PIC____STRING_INLINE char *strpbrk (__const char *__s, __const char *__accept){  unsigned long int __d0, __d1, __d2;  register char *__res;  __asm__ __volatile__    ("pushl	%%ebx\n\t"     "cld\n\t"     "movl	%4,%%edi\n\t"     "repne; scasb\n\t"     "notl	%%ecx\n\t"     "decl	%%ecx\n\t"     "movl	%%ecx,%%ebx\n"     "1:\n\t"     "lodsb\n\t"     "testb	%%al,%%al\n\t"     "je	2f\n\t"     "movl	%4,%%edi\n\t"     "movl	%%ebx,%%ecx\n\t"     "repne; scasb\n\t"     "jne	1b\n\t"     "decl	%0\n\t"     "jmp	3f\n"     "2:\n\t"     "xorl	%0,%0\n"     "3:\n\t"     "popl	%%ebx"     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)     : "r" (__accept), "0" (__s), "1" (0), "2" (0xffffffff)     : "cc");  return __res;}# else__STRING_INLINE char *strpbrk (__const char *__s, __const char *__accept){  register unsigned long int __d0, __d1, __d2, __d3;  register char *__res;  __asm__ __volatile__    ("cld\n\t"     "movl	%5,%%edi\n\t"     "repne; scasb\n\t"     "notl	%%ecx\n\t"     "decl	%%ecx\n\t"     "movl	%%ecx,%%edx\n"     "1:\n\t"     "lodsb\n\t"     "testb	%%al,%%al\n\t"     "je	2f\n\t"     "movl	%5,%%edi\n\t"     "movl	%%edx,%%ecx\n\t"     "repne; scasb\n\t"     "jne	1b\n\t"     "decl	%0\n\t"     "jmp	3f\n"     "2:\n\t"     "xorl	%0,%0\n"     "3:"     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)     : "g" (__accept), "0" (__s), "1" (0), "2" (0xffffffff)     : "cc");  return __res;}# endif#endif/* Find the first occurrence of NEEDLE in HAYSTACK.  */#define _HAVE_STRING_ARCH_strstr 1#ifndef _FORCE_INLINES# ifdef __PIC____STRING_INLINE char *strstr (__const char *__haystack, __const char *__needle){  register unsigned long int __d0, __d1, __d2;  register char *__res;  __asm__ __volatile__    ("pushl	%%ebx\n\t"     "cld\n\t" \     "movl	%4,%%edi\n\t"     "repne; scasb\n\t"     "notl	%%ecx\n\t"     "decl	%%ecx\n\t"	/* NOTE! This also sets Z if searchstring='' */     "movl	%%ecx,%%ebx\n"     "1:\n\t"     "movl	%4,%%edi\n\t"     "movl	%%esi,%%eax\n\t"     "movl	%%ebx,%%ecx\n\t"     "repe; cmpsb\n\t"     "je	2f\n\t"		/* also works for empty string, see above */     "xchgl	%%eax,%%esi\n\t"     "incl	%%esi\n\t"     "cmpb	$0,-1(%%eax)\n\t"     "jne	1b\n\t"     "xorl	%%eax,%%eax\n\t"     "2:\n\t"     "popl	%%ebx"     : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)     : "r" (__needle), "0" (0), "1" (0xffffffff), "2" (__haystack)     : "cc");  return __res;}# else__STRING_INLINE char *strstr (__const char *__haystack, __const char *__needle){  register unsigned long int __d0, __d1, __d2, __d3;  register char *__res;  __asm__ __volatile__    ("cld\n\t" \     "movl	%5,%%edi\n\t"     "repne; scasb\n\t"     "notl	%%ecx\n\t"     "decl	%%ecx\n\t"	/* NOTE! This also sets Z if searchstring='' */     "movl	%%ecx,%%edx\n"     "1:\n\t"     "movl	%5,%%edi\n\t"     "movl	%%esi,%%eax\n\t"     "movl	%%edx,%%ecx\n\t"     "repe; cmpsb\n\t"     "je	2f\n\t"		/* also works for empty string, see above */     "xchgl	%%eax,%%esi\n\t"     "incl	%%esi\n\t"     "cmpb	$0,-1(%%eax)\n\t"     "jne	1b\n\t"     "xorl	%%eax,%%eax\n\t"     "2:"     : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&d" (__d2), "=&D" (__d3)     : "g" (__needle), "0" (0), "1" (0xffffffff), "2" (__haystack)     : "cc");  return __res;}# endif#endif#ifndef _FORCE_INLINES# undef __STRING_INLINE#endif#endif	/* use string inlines && GNU CC */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -