www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/03/21/19:14:45

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: DJGPP AT sun DOT soe DOT clarkson DOT edu
Date: Tue, 21 Mar 1995 16:39:04 GMT
Subject: A quick way to copy n bytes

/*-----*//* 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 */

- Raw text -


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