Mail Archives: djgpp/1997/06/06/16:49:26
Mlsoftware <mlsoftware AT aol DOT com> 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.
- Raw text -