[Fwd: faster strcpy()]

Samuel Leo (samuel@szonline.net)
Sun, 26 Apr 1998 14:53:35 +0800


Actually, I found strcpy() in SCO OpenServer 5 implemente as strlen + memcpy,
Why glibc2 still use the stupid code.

develop:/tmp# ar xv /usr/lib/libc.a strcpy.o
x - strcpy.o
develop:/tmp# dis strcpy.o
**** DISASSEMBLER ****

disassembly for strcpy.o

section .text
.text
strcpy
0: 8b d7 movl %edi,%edx
2: 56 pushl %esi
3: 8b 7c 24 0c movl 12(%esp),%edi
7: 33 c0 xorl %eax,%eax
9: b9 ff ff ff ff movl $0xffffffff,%ecx
e: f2 ae repnz scasb %al,(%edi)
10: f7 d1 notl %ecx
12: 8b 74 24 0c movl 12(%esp),%esi
16: 8b 7c 24 08 movl 8(%esp),%edi
1a: 8b c1 movl %ecx,%eax
1c: c1 e9 02 shrl $0x2,%ecx
1f: f3 a5 repz movsl (%esi),(%edi)
21: 8b c8 movl %eax,%ecx
23: 81 e1 03 00 00 00 andl $0x3,%ecx
29: f3 a4 repz movsb (%esi),(%edi)
2b: 8b 44 24 08 movl 8(%esp),%eax
2f: 5e popl %esi
30: 8b fa movl %edx,%edi
32: c3 ret
33: 90 nop
develop:/tmp#

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu