X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fv850%2Flib%2Fmemset.c;h=d1b2ad821b15a9ec335d90679d5ee35d7927fab0;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=a724d31d1b9e581e260cb3af277da628223c5552;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/arch/v850/lib/memset.c b/arch/v850/lib/memset.c index a724d31d1..d1b2ad821 100644 --- a/arch/v850/lib/memset.c +++ b/arch/v850/lib/memset.c @@ -1,8 +1,8 @@ /* * arch/v850/lib/memset.c -- Memory initialization * - * Copyright (C) 2001,02 NEC Corporation - * Copyright (C) 2001,02 Miles Bader + * Copyright (C) 2001,02,04 NEC Corporation + * Copyright (C) 2001,02,04 Miles Bader * * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this @@ -26,11 +26,13 @@ void *memset (void *dst, int val, __kernel_size_t count) /* copy initial unaligned bytes. */ if ((long)ptr & 1) { - *((char *)ptr)++ = val; + *(char *)ptr = val; + ptr = (void *)((char *)ptr + 1); count--; } if (count > 2 && ((long)ptr & 2)) { - *((short *)ptr)++ = val; + *(short *)ptr = val; + ptr = (void *)((short *)ptr + 1); count -= 2; } @@ -46,15 +48,20 @@ void *memset (void *dst, int val, __kernel_size_t count) count %= 32; /* long copying loop. */ - for (loop = count / 4; loop; loop--) - *((long *)ptr)++ = val; + for (loop = count / 4; loop; loop--) { + *(long *)ptr = val; + ptr = (void *)((long *)ptr + 1); + } count %= 4; /* finish up with any trailing bytes. */ - if (count & 2) - *((short *)ptr)++ = val; - if (count & 1) + if (count & 2) { + *(short *)ptr = val; + ptr = (void *)((short *)ptr + 1); + } + if (count & 1) { *(char *)ptr = val; + } } return dst;