diff options
| author | Michael Brown | 2012-11-05 00:53:59 +0100 |
|---|---|---|
| committer | Michael Brown | 2012-11-12 17:58:49 +0100 |
| commit | 06766875ada566a95ff22aef2d6c7fadec4da4b8 (patch) | |
| tree | 823062d8fe48fe723074882ae6668280d6e49086 /src/arch/x86/include | |
| parent | [libc] Remove unnecessary "cld" instruction from memset() (diff) | |
| download | ipxe-06766875ada566a95ff22aef2d6c7fadec4da4b8.tar.gz ipxe-06766875ada566a95ff22aef2d6c7fadec4da4b8.tar.xz ipxe-06766875ada566a95ff22aef2d6c7fadec4da4b8.zip | |
[libc] Reduce overall code size by externalising strncmp()
Typical saving is 20-30 bytes in each file using strncmp().
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/include')
| -rw-r--r-- | src/arch/x86/include/bits/string.h | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/arch/x86/include/bits/string.h b/src/arch/x86/include/bits/string.h index 5736295ab..75a1f01a8 100644 --- a/src/arch/x86/include/bits/string.h +++ b/src/arch/x86/include/bits/string.h @@ -230,27 +230,8 @@ return dest; } #define __HAVE_ARCH_STRNCMP -static inline int strncmp(const char * cs,const char * ct,size_t count) -{ -register int __res; -int d0, d1, d2; -__asm__ __volatile__( - "1:\tdecl %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:\txorl %%eax,%%eax\n\t" - "jmp 4f\n" - "3:\tsbbl %%eax,%%eax\n\t" - "orb $1,%%al\n" - "4:" - :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) - :"1" (cs),"2" (ct),"3" (count)); -return __res; -} + +extern int strncmp ( const char *str1, const char *str2, size_t len ); #define __HAVE_ARCH_STRLEN static inline size_t strlen(const char * s) |
