Re: [PATCH 2/6] newlib: memccpy: unify mask filling with other memory functions
Corinna Vinschen <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On Jan 27 10:45, Alexey Lapshin wrote:
> This change made just to have memccpy like others mem-functions
> ---
> newlib/libc/string/memccpy.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c
> index 332332489..802723a2e 100644
> --- a/newlib/libc/string/memccpy.c
> +++ b/newlib/libc/string/memccpy.c
> @@ -69,7 +69,7 @@ memccpy (void *__restrict dst0,
> if (!TOO_SMALL_LITTLE_BLOCK(len0) && !UNALIGNED_X_Y(src, dst))
> {
> unsigned int i;
> - unsigned long mask = 0;
> + unsigned long mask;
>
> aligned_dst = (long*)dst;
> aligned_src = (long*)src;
> @@ -80,9 +80,10 @@ memccpy (void *__restrict dst0,
> the word-sized segment with a word-sized block of the search
> character and then detecting for the presence of NULL in the
> result. */
> - for (i = 0; i < sizeof(mask); i++)
> - mask = (mask << 8) + endchar;
> + mask = endchar << 8 | endchar;
> + mask = mask << 16 | mask;
> + for (i = 32; i < sizeof(mask) * 8; i <<= 1)
> + mask = (mask << i) | endchar;
^^^^^^^
Shouldn't that be mask?
Corinna