Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-10 Thread Eric Lammerts
On 10/08/09 03:41, Alessandro Rubini wrote: > For memcpy all is well, for memset I have this problem: > if (sizeof(long) > 4) > cl |= cl << 32; > string.c:416: warning: left shift count >= width of type > > (obviously there is no such shift in the generated co

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-08 Thread Wolfgang Denk
Dear Joakim Tjernlund, In message you wrote: > > So my question is: Did you check all gcc versions and > arches? Of course not :-) Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenze

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-08 Thread Joakim Tjernlund
Wolfgang Denk wrote on 08/10/2009 14:49:15: > > Dear Joakim Tjernlund, > > In message 0031e...@transmode.se> you wrote: > > > > > How about: > > > > > > cl = 0; > > > for (i=0; i > > cl <<= 8; > > > cl |= c & 0xff; > > > } > > > > > > GCC optimization will do t

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-08 Thread Wolfgang Denk
Dear Joakim Tjernlund, In message you wrote: > > > How about: > > > > cl = 0; > > for (i=0; i > cl <<= 8; > > cl |= c & 0xff; > > } > > > > GCC optimization will do the rest... > > If you want gcc to optimise well, make it easy to do so. > Changing the for l

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-08 Thread Joakim Tjernlund
> > Dear Alessandro Rubini, > > In message <20091008074114.ga30...@mail.gnudd.com> you wrote: > > > > Since int is 32 also on 64bit systems, I used unsigned long. > > Note that this is not guaranteed, though. It could be 64 bit as well. > > > >/* do it one word at a time (32 bits or 64 bits

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-08 Thread Wolfgang Denk
Dear Alessandro Rubini, In message <20091008074114.ga30...@mail.gnudd.com> you wrote: > > Since int is 32 also on 64bit systems, I used unsigned long. Note that this is not guaranteed, though. It could be 64 bit as well. > /* do it one word at a time (32 bits or 64 bits) if possible */ >

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-08 Thread Alessandro Rubini
I was making my v2, and I found a problem wrt: > while 64bit isnt in today, might as well avoid unclean code from the start > when possible. in other words, used "unsigned int" rather than "u32" and cast > to "unsigned long" rather than "int". Since int is 32 also on 64bit systems, I used unsign

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-07 Thread Mike Frysinger
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) > > { > >

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-07 Thread Chris Moore
Alessandro Rubini a écrit : > From: Alessandro Rubini > > Signed-off-by: Alessandro Rubini > Acked-by: Andrea Gallo > --- > lib_generic/string.c | 11 ++- > 1 files changed, 10 insertions(+), 1 deletions(-) > > diff --git a/lib_generic/string.c b/lib_generic/string.c > index 181eda6..

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-07 Thread Mike Frysinger
On Wednesday 07 October 2009 10:35:19 Peter Tyser wrote: > > --- 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

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-07 Thread Peter Tyser
Hi Alessandro, > --- 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 *)des

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-07 Thread Wolfgang Denk
Dear Mike Frysinger, In message <200910070452.02225.vap...@gentoo.org> you wrote: > > > --- 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) > > { > >

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-07 Thread Alessandro Rubini
> while 64bit isnt in today, might as well avoid unclean code from the > start when possible. in other words, used "unsigned int" rather > than "u32" and cast to "unsigned long" rather than "int". You are right. Will do. >> +count /= 4; > count >>= 2 ? although gcc probably optimi

Re: [U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-07 Thread Mike Frysinger
On Wednesday 07 October 2009 04:44:26 Alessandro Rubini wrote: > --- 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, *

[U-Boot] [PATCH 1/3] memcpy: use 32-bit copies if possible

2009-10-07 Thread Alessandro Rubini
From: Alessandro Rubini Signed-off-by: Alessandro Rubini Acked-by: Andrea Gallo --- lib_generic/string.c | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/lib_generic/string.c b/lib_generic/string.c index 181eda6..fdccab6 100644 --- a/lib_generic/string.c +++