binutils-gdb/libiberty/bcopy.c
Andrew Burgess be3a9405ce libiberty: sync with gcc commit df3510f80e7c02d9
Sync the libiberty/ directory with gcc commit
df3510f80e7c02d9c19d7cb33759cd925880f53a.  This pulls in the following
gcc commits and the associated updates to 'libiberty/ChangeLog':

  * 06fb00cb66d libiberty: Fix typos in various files
  * fbf903e5b9f Re-flow lines made longer than 80 characters by typo fixes
  * cfb945957ee Regenerate some autoconf configure scripts after recent spelling fixes.
  * bc4d9b6aeb3 libiberty: avoid exponential back reference issue in D demangler

I have retained the changes that are in the following binutils-gdb
commit, which are not in gcc:

  commit 219822fd5d
  Date:   Tue Apr 9 06:39:21 2024 -0700

    mmap: Avoid the sanitizer configure check failure
2026-06-20 13:02:37 +01:00

31 lines
695 B
C

/* bcopy -- copy memory regions of arbitrary length
@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
Copies @var{length} bytes from memory region @var{in} to region
@var{out}. The use of @code{bcopy} is deprecated in new programs.
@end deftypefn
*/
#include <stddef.h>
void
bcopy (const void *src, void *dest, size_t len)
{
if (dest < src)
{
const char *firsts = (const char *) src;
char *firstd = (char *) dest;
while (len--)
*firstd++ = *firsts++;
}
else
{
const char *lasts = (const char *)src + (len-1);
char *lastd = (char *)dest + (len-1);
while (len--)
*lastd-- = *lasts--;
}
}