include/
[official-gcc.git] / libiberty / bcopy.c
blob0944247464593ecf4b20e4ad81ff68f3641d2cfc
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 (register char *src, register char *dest, int len)
15 if (dest < src)
16 while (len--)
17 *dest++ = *src++;
18 else
20 char *lasts = src + (len-1);
21 char *lastd = dest + (len-1);
22 while (len--)
23 *(char *)lastd-- = *(char *)lasts--;