X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libiberty%2Fbcopy.c;fp=libiberty%2Fbcopy.c;h=f9b7a8acd5c72bbd870789f44124135bad5a06ab;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=70fa7e328cc68f558c638493c4c537621b8a088b;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libiberty/bcopy.c b/libiberty/bcopy.c index 70fa7e32..f9b7a8ac 100644 --- a/libiberty/bcopy.c +++ b/libiberty/bcopy.c @@ -9,19 +9,23 @@ Copies @var{length} bytes from memory region @var{in} to region */ +#include + void -bcopy (src, dest, len) - register char *src, *dest; - int len; +bcopy (const void *src, void *dest, size_t len) { if (dest < src) - while (len--) - *dest++ = *src++; + { + const char *firsts = (const char *) src; + char *firstd = (char *) 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--; } }