From 14a88c496bef288d66f245d1d07c7bfa7f6062fb Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Sun, 3 Apr 2005 04:41:10 +0000 Subject: merge from gcc --- libiberty/bcopy.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'libiberty/bcopy.c') diff --git a/libiberty/bcopy.c b/libiberty/bcopy.c index 0944247464..1e2eca9c64 100644 --- a/libiberty/bcopy.c +++ b/libiberty/bcopy.c @@ -9,17 +9,23 @@ Copies @var{length} bytes from memory region @var{in} to region */ +#include + void -bcopy (register char *src, register char *dest, int len) +bcopy (const void *src, void *dest, size_t len) { if (dest < src) - while (len--) - *dest++ = *src++; + { + const char *firsts = src; + char *firstd = dest; + while (len--) + *firstd++ = *firsts++; + } else { - char *lasts = src + (len-1); - char *lastd = dest + (len-1); + const char *lasts = (const char *)src + (len-1); + char *lastd = (char *)dest + (len-1); while (len--) - *(char *)lastd-- = *(char *)lasts--; + *lastd-- = *lasts--; } } -- cgit v1.2.3