gcc/libiberty/bcopy.c

28 lines
579 B
C
Raw Normal View History

1997-08-22 06:57:35 +08:00
/* bcopy -- copy memory regions of arbitary length
@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
1997-08-22 06:57:35 +08:00
Copies @var{length} bytes from memory region @var{in} to region
@var{out}. The use of @code{bcopy} is deprecated in new programs.
1997-08-22 06:57:35 +08:00
@end deftypefn
1997-08-22 06:57:35 +08:00
*/
void
bcopy (src, dest, len)
register char *src, *dest;
int len;
{
if (dest < src)
while (len--)
*dest++ = *src++;
else
{
char *lasts = src + (len-1);
char *lastd = dest + (len-1);
while (len--)
*(char *)lastd-- = *(char *)lasts--;
}
}