www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/03/21/22:58:34

Date: Wed, 22 Mar 1995 12:30:25 +0900
From: Stephen Turnbull <turnbull AT shako DOT sk DOT tsukuba DOT ac DOT jp>
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" <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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019