delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/05/18:09:36

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

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" )

- Raw text -


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