diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-03-15 22:20:43 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-03-15 22:20:43 +0000 |
commit | 46b17fd21b2b16c60c2d0c242ed15fad6ab17fc6 (patch) | |
tree | c15d088d219cbc2963bcc42c35634a9e4bb296c9 /gnu/lib/libg++/libiberty/bcopy.c | |
parent | f534d44ccdb17011802f89b9ad24fa0712693698 (diff) |
Import of GNU libg++ 2.7.1 port (prepared by Erik Theisen)
Diffstat (limited to 'gnu/lib/libg++/libiberty/bcopy.c')
-rw-r--r-- | gnu/lib/libg++/libiberty/bcopy.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gnu/lib/libg++/libiberty/bcopy.c b/gnu/lib/libg++/libiberty/bcopy.c new file mode 100644 index 00000000000..b655363d879 --- /dev/null +++ b/gnu/lib/libg++/libiberty/bcopy.c @@ -0,0 +1,35 @@ +/* bcopy -- copy memory regions of arbitary length + +NAME + bcopy -- copy memory regions of arbitrary length + +SYNOPSIS + void bcopy (char *in, char *out, int length) + +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. + +*/ + +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--; + } +} |