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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [m68k/] [lib/] [memcpy.c] - Diff between revs 1765 and 1782

Only display areas with differences | Details | Blame | View Log

Rev 1765 Rev 1782
#include <linux/types.h>
#include <linux/types.h>
 
 
void * memcpy(void * to, const void * from, size_t n)
void * memcpy(void * to, const void * from, size_t n)
{
{
  void *xto = to;
  void *xto = to;
  size_t temp;
  size_t temp;
 
 
  if (!n)
  if (!n)
    return xto;
    return xto;
  if ((long) to & 1)
  if ((long) to & 1)
    {
    {
      char *cto = to;
      char *cto = to;
      const char *cfrom = from;
      const char *cfrom = from;
      *cto++ = *cfrom++;
      *cto++ = *cfrom++;
      to = cto;
      to = cto;
      from = cfrom;
      from = cfrom;
      n--;
      n--;
    }
    }
  if (n > 2 && (long) to & 2)
  if (n > 2 && (long) to & 2)
    {
    {
      short *sto = to;
      short *sto = to;
      const short *sfrom = from;
      const short *sfrom = from;
      *sto++ = *sfrom++;
      *sto++ = *sfrom++;
      to = sto;
      to = sto;
      from = sfrom;
      from = sfrom;
      n -= 2;
      n -= 2;
    }
    }
  temp = n >> 2;
  temp = n >> 2;
  if (temp)
  if (temp)
    {
    {
      long *lto = to;
      long *lto = to;
      const long *lfrom = from;
      const long *lfrom = from;
      temp--;
      temp--;
      do
      do
        *lto++ = *lfrom++;
        *lto++ = *lfrom++;
      while (temp--);
      while (temp--);
      to = lto;
      to = lto;
      from = lfrom;
      from = lfrom;
    }
    }
  if (n & 2)
  if (n & 2)
    {
    {
      short *sto = to;
      short *sto = to;
      const short *sfrom = from;
      const short *sfrom = from;
      *sto++ = *sfrom++;
      *sto++ = *sfrom++;
      to = sto;
      to = sto;
      from = sfrom;
      from = sfrom;
    }
    }
  if (n & 1)
  if (n & 1)
    {
    {
      char *cto = to;
      char *cto = to;
      const char *cfrom = from;
      const char *cfrom = from;
      *cto = *cfrom;
      *cto = *cfrom;
    }
    }
  return xto;
  return xto;
}
}
 
 

powered by: WebSVN 2.1.0

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