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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [m68k/] [lib/] [memcpy.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1623 jcastillo
#include <linux/types.h>
2
 
3
void * memcpy(void * to, const void * from, size_t n)
4
{
5
  void *xto = to;
6
  size_t temp;
7
 
8
  if (!n)
9
    return xto;
10
  if ((long) to & 1)
11
    {
12
      char *cto = to;
13
      const char *cfrom = from;
14
      *cto++ = *cfrom++;
15
      to = cto;
16
      from = cfrom;
17
      n--;
18
    }
19
  if (n > 2 && (long) to & 2)
20
    {
21
      short *sto = to;
22
      const short *sfrom = from;
23
      *sto++ = *sfrom++;
24
      to = sto;
25
      from = sfrom;
26
      n -= 2;
27
    }
28
  temp = n >> 2;
29
  if (temp)
30
    {
31
      long *lto = to;
32
      const long *lfrom = from;
33
      temp--;
34
      do
35
        *lto++ = *lfrom++;
36
      while (temp--);
37
      to = lto;
38
      from = lfrom;
39
    }
40
  if (n & 2)
41
    {
42
      short *sto = to;
43
      const short *sfrom = from;
44
      *sto++ = *sfrom++;
45
      to = sto;
46
      from = sfrom;
47
    }
48
  if (n & 1)
49
    {
50
      char *cto = to;
51
      const char *cfrom = from;
52
      *cto = *cfrom;
53
    }
54
  return xto;
55
}

powered by: WebSVN 2.1.0

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