Mail Archives: djgpp/1995/03/21/22:58:34
From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
/*-----*//* 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 / <turnbull AT shako DOT sk DOT tsukuba DOT ac DOT jp>
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/
- Raw text -