From: mlsoftware AT aol DOT com (Mlsoftware) Newsgroups: comp.os.msdos.djgpp Subject: Re: 32 bit Memory Operations Date: 4 Jun 1997 06:02:10 GMT Lines: 22 Message-ID: <19970604060201.CAA06697@ladder02.news.aol.com> NNTP-Posting-Host: ladder02.news.aol.com Organization: AOL http://www.aol.com References: <865393956 DOT 26276 AT dejanews DOT com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk The following macros are about as fast as you're going to get. They accept words rather than bytes, as they copy 4 bytes at a time. 1 WORD = 4 BYTES, so when you tell it how many words to copy, make sure it's the (# OF BYTES/4) The following are stolen from Brennan's AT&T Assembly FAQ, I think. #define quad_memcpy(src, dest, numwords) \ __asm__ __volatile__ ( \ "cld\n\t" \ "rep\n\t" \ "movsl" \ : : "S" (src), "D" (dest), "c" (numwords) \ : "%ecx", "%esi", "%edi" ) #define quad_memset(value, dest, numwords) \ __asm__ __volatile__ ( \ "cld\n\t" \ "rep\n\t" \ "stosl" \ : : "a" (value), "D" (dest), "c" (numwords) \ : "%ecx", "%edi" )