delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/06/16:49:26

Message-Id: <199706062045.UAA14496@mx2.rmplc.co.uk>
From: "Liam" <marl AT rmplc DOT co DOT uk>
To: "Mlsoftware" <mlsoftware AT aol DOT com>, <djgpp AT delorie DOT com>
Subject: Re: 32 bit Memory Operations
Date: Fri, 6 Jun 1997 12:28:26 +0100
MIME-Version: 1.0

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 -


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