OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [libiberty/] [bcopy.c] - Diff between revs 156 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.