Merge from gcc
[binutils.git] / libiberty / bcopy.c
blob70fa7e328cc68f558c638493c4c537621b8a088b
1 /* bcopy -- copy memory regions of arbitary length
3 @deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
5 Copies @var{length} bytes from memory region @var{in} to region
6 @var{out}. The use of @code{bcopy} is deprecated in new programs.
8 @end deftypefn
12 void
13 bcopy (src, dest, len)
14 register char *src, *dest;
15 int len;
17 if (dest < src)
18 while (len--)
19 *dest++ = *src++;
20 else
22 char *lasts = src + (len-1);
23 char *lastd = dest + (len-1);
24 while (len--)
25 *(char *)lastd-- = *(char *)lasts--;