Date: Wed, 22 Mar 1995 12:30:25 +0900 From: Stephen Turnbull To: A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk Cc: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU Subject: A quick way to copy n bytes From: "A.Appleyard" /*-----*//* fast move s[0:n-1]=t[0:n-1] */ void str_cpy(void*s,void*t,int n){ asm("pushl %esi"); asm("pushl %edi"); asm("cld"); asm("movl 8(%ebp),%edi"); asm("movl 12(%ebp),%esi"); asm("movl 16(%ebp),%ecx"); asm("rep"); asm("movsb"); asm("popl %edi"); asm("popl %esi");} /*-----*/ /* This has given me good service and should run a bit quicker than a C */ /* version, as it uses the `rep' repeat instruction */ This looks remarkably like memcpy.s in the standard DJGPP library, but it doesn't take advantage of a couple of optimizations included in the DJGPP distribution version. Why are we reinventing the wheel? -- Stephen Turnbull / Yaseppochi-gumi / http://turnbull.sk.tsukuba.ac.jp/ anon FTP: turnbull.sk.tsukuba.ac.jp Check out Kansai-WWW, too ------------> http://pclsp2.kuicr.kyoto-u.ac.jp/