X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=libiberty%2Fbcopy.c;h=f9b7a8acd5c72bbd870789f44124135bad5a06ab;hb=7992accc6e5dc674ab209397acc1d840f869c326;hp=b655363d879e58f4b7f9377702964fdbd989af71;hpb=5b64ad42d36e6d487e1f7287d37fbc243a178e72;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/bcopy.c b/libiberty/bcopy.c index b655363d87..f9b7a8acd5 100644 --- a/libiberty/bcopy.c +++ b/libiberty/bcopy.c @@ -1,35 +1,31 @@ /* bcopy -- copy memory regions of arbitary length -NAME - bcopy -- copy memory regions of arbitrary length +@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length}) -SYNOPSIS - void bcopy (char *in, char *out, int length) +Copies @var{length} bytes from memory region @var{in} to region +@var{out}. The use of @code{bcopy} is deprecated in new programs. -DESCRIPTION - Copy LENGTH bytes from memory region pointed to by IN to memory - region pointed to by OUT. - -BUGS - Significant speed improvements can be made in some cases by - implementing copies of multiple bytes simultaneously, or unrolling - the copy loop. +@end deftypefn */ +#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--; } }