From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Moore Date: Sun, 11 Oct 2009 09:06:17 +0200 Subject: [U-Boot] [PATCH V2 1/3] memcpy: copy one word at a time if possible In-Reply-To: <200910090627.00401.vapier@gentoo.org> References: <4ACEBF19.4010902@free.fr> <4ACF0C44.9040101@mimc.co.uk> <200910090627.00401.vapier@gentoo.org> Message-ID: <4AD183E9.3080103@free.fr> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Mike Frysinger a ?crit : > On Friday 09 October 2009 06:11:16 Mark Jackson wrote: > >> Chris Moore wrote: >> >>> I agree wholeheartedly with the idea but shouldn't it be more like this >>> (untested) code : >>> >>> void * memcpy(void *dest, const void *src, size_t count) >>> >>> { >>> char *d8, *s8; >>> unsigned long *dl = dest, *sl = src; >>> >> In here, would it be overkill to add byte copying until data is aligned, >> and then fall into the aligned copy code. >> > > both addresses have to be unaligned the same ... > > if ((ulong)dl & (sizeof(*dl) - 1) == (ulong)sl & (sizeof(*sl) - 1)) > > >> In that case, you'd still gain a speed increase if you're starting at an >> unaligned address ? >> > > now it's a question of how often does this come up and is it worth the code > size increase ? > Like Mike I'm not sure if it is worth it for memcpy. However it may be for memset where only the destination has to be aligned. Chris