From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Thu, 8 Oct 2009 02:05:53 -0400 Subject: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible In-Reply-To: <4ACD7739.8040800@free.fr> References: <4ACD7739.8040800@free.fr> Message-ID: <200910080205.55199.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thursday 08 October 2009 01:23:05 Chris Moore wrote: > Alessandro Rubini a ?crit : > > --- a/lib_generic/string.c > > +++ b/lib_generic/string.c > > @@ -449,7 +449,16 @@ char * bcopy(const char * src, char * dest, int > > count) void * memcpy(void * dest,const void *src,size_t count) > > { > > char *tmp = (char *) dest, *s = (char *) src; > > + u32 *d32 = (u32 *)dest, *s32 = (u32 *) src; > > > > + /* if both are aligned, use 32-bit copy */ > > + if ( (((int)dest & 3) | ((int)src & 3) | (count & 3)) == 0 ) { > > This can be factorized as (a & 3) | (b & 3) | (c & 3) is equivalent to > (a | b | c) & 3. > GCC is pretty smart but I doubt that it will pick this up :( last time i looked (gcc-4.1 and gcc-4.3), it worked fine -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20091008/6b8468e2/attachment.pgp