Message-Id: <199706062045.UAA14496@mx2.rmplc.co.uk> From: "Liam" To: "Mlsoftware" , Subject: Re: 32 bit Memory Operations Date: Fri, 6 Jun 1997 12:28:26 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Precedence: bulk Mlsoftware wrote: > 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) Thats wrong, ONE WORD is equilivant to TWO BYTES NOT FOUR. > #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" ) Those routines are moveing double words or in AT&T, long words, which are FOUR BYTES.