1999-05-03 15:29:11 +08:00
|
|
|
/* bcopy -- copy memory regions of arbitary length
|
|
|
|
|
2001-09-27 02:45:50 +08:00
|
|
|
@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2001-09-27 02:45:50 +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.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2001-09-27 02:45:50 +08:00
|
|
|
@end deftypefn
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2005-03-27 13:28:42 +08:00
|
|
|
bcopy (register char *src, register char *dest, int len)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
if (dest < src)
|
|
|
|
while (len--)
|
|
|
|
*dest++ = *src++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char *lasts = src + (len-1);
|
|
|
|
char *lastd = dest + (len-1);
|
|
|
|
while (len--)
|
|
|
|
*(char *)lastd-- = *(char *)lasts--;
|
|
|
|
}
|
|
|
|
}
|