]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/bcopy.c
Remove unnecessary string literals from static_assert in C++17 tests
[thirdparty/gcc.git] / libiberty / bcopy.c
CommitLineData
28e9041c 1/* bcopy -- copy memory regions of arbitary length
2
614a23c6 3@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
28e9041c 4
614a23c6 5Copies @var{length} bytes from memory region @var{in} to region
6@var{out}. The use of @code{bcopy} is deprecated in new programs.
28e9041c 7
614a23c6 8@end deftypefn
28e9041c 9
10*/
11
943c390a 12#include <stddef.h>
13
28e9041c 14void
943c390a 15bcopy (const void *src, void *dest, size_t len)
28e9041c 16{
17 if (dest < src)
943c390a 18 {
1dc5cee9 19 const char *firsts = (const char *) src;
20 char *firstd = (char *) dest;
943c390a 21 while (len--)
22 *firstd++ = *firsts++;
23 }
28e9041c 24 else
25 {
943c390a 26 const char *lasts = (const char *)src + (len-1);
27 char *lastd = (char *)dest + (len-1);
28e9041c 28 while (len--)
943c390a 29 *lastd-- = *lasts--;
28e9041c 30 }
31}