Commit 0989bee0 authored by Miles Bader's avatar Miles Bader Committed by Linus Torvalds

[PATCH] v850: Get rid of lvalue-casts in memset.c to make gcc happy

Signed-off-by: default avatarMiles Bader <miles@gnu.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6392f9cb
/* /*
* arch/v850/lib/memset.c -- Memory initialization * arch/v850/lib/memset.c -- Memory initialization
* *
* Copyright (C) 2001,02 NEC Corporation * Copyright (C) 2001,02,04 NEC Corporation
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org> * Copyright (C) 2001,02,04 Miles Bader <miles@gnu.org>
* *
* This file is subject to the terms and conditions of the GNU General * 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 * 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) ...@@ -26,11 +26,13 @@ void *memset (void *dst, int val, __kernel_size_t count)
/* copy initial unaligned bytes. */ /* copy initial unaligned bytes. */
if ((long)ptr & 1) { if ((long)ptr & 1) {
*((char *)ptr)++ = val; *(char *)ptr = val;
ptr = (void *)((char *)ptr + 1);
count--; count--;
} }
if (count > 2 && ((long)ptr & 2)) { if (count > 2 && ((long)ptr & 2)) {
*((short *)ptr)++ = val; *(short *)ptr = val;
ptr = (void *)((short *)ptr + 1);
count -= 2; count -= 2;
} }
...@@ -46,15 +48,20 @@ void *memset (void *dst, int val, __kernel_size_t count) ...@@ -46,15 +48,20 @@ void *memset (void *dst, int val, __kernel_size_t count)
count %= 32; count %= 32;
/* long copying loop. */ /* long copying loop. */
for (loop = count / 4; loop; loop--) for (loop = count / 4; loop; loop--) {
*((long *)ptr)++ = val; *(long *)ptr = val;
ptr = (void *)((long *)ptr + 1);
}
count %= 4; count %= 4;
/* finish up with any trailing bytes. */ /* finish up with any trailing bytes. */
if (count & 2) if (count & 2) {
*((short *)ptr)++ = val; *(short *)ptr = val;
if (count & 1) ptr = (void *)((short *)ptr + 1);
}
if (count & 1) {
*(char *)ptr = val; *(char *)ptr = val;
}
} }
return dst; return dst;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment