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 code,

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

2009-10-08 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) { char

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 unsigned long.

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 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) if possible

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

2009-10-08 Thread Wolfgang Denk
Dear Joakim Tjernlund, In message of26fea2cb.36e102ee-onc1257649.0031301d-c1257649.0031e...@transmode.se you wrote: How about: cl = 0; for (i=0; isizeof(long); ++i) { cl = 8; cl |= c 0xff; } GCC optimization will do the rest... If you

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

2009-10-08 Thread Joakim Tjernlund
Wolfgang Denk w...@denx.de wrote on 08/10/2009 14:49:15: Dear Joakim Tjernlund, In message OF26FEA2CB.36E102EE-ONC1257649.0031301D-C1257649. 0031e...@transmode.se you wrote: How about: cl = 0; for (i=0; isizeof(long); ++i) { cl = 8; cl |= c

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

2009-10-08 Thread Wolfgang Denk
Dear Joakim Tjernlund, In message of15edfd3f.769f0248-onc1257649.0049c8ae-c1257649.004a1...@transmode.se 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

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

2009-10-07 Thread Alessandro Rubini
From: Alessandro Rubini rub...@unipv.it Signed-off-by: Alessandro Rubini rub...@unipv.it Acked-by: Andrea Gallo andrea.ga...@stericsson.com --- lib_generic/string.c | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/lib_generic/string.c b/lib_generic/string.c

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, *s =

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 optimizes this

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 *)dest,

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 rub...@unipv.it Signed-off-by: Alessandro Rubini rub...@unipv.it Acked-by: Andrea Gallo andrea.ga...@stericsson.com --- lib_generic/string.c | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git