Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / m68knommu / lib / memcpy.c
blob0d5577569e4c7230b42db6ebcfe7968ce24f6474
2 #include <linux/types.h>
3 #include <linux/autoconf.h>
5 void * memcpy(void * to, const void * from, size_t n)
7 #ifdef CONFIG_COLDFIRE
8 void *xto = to;
9 size_t temp;
11 if (!n)
12 return xto;
13 if ((long) to & 1)
15 char *cto = to;
16 const char *cfrom = from;
17 *cto++ = *cfrom++;
18 to = cto;
19 from = cfrom;
20 n--;
22 if (n > 2 && (long) to & 2)
24 short *sto = to;
25 const short *sfrom = from;
26 *sto++ = *sfrom++;
27 to = sto;
28 from = sfrom;
29 n -= 2;
31 temp = n >> 2;
32 if (temp)
34 long *lto = to;
35 const long *lfrom = from;
36 for (; temp; temp--)
37 *lto++ = *lfrom++;
38 to = lto;
39 from = lfrom;
41 if (n & 2)
43 short *sto = to;
44 const short *sfrom = from;
45 *sto++ = *sfrom++;
46 to = sto;
47 from = sfrom;
49 if (n & 1)
51 char *cto = to;
52 const char *cfrom = from;
53 *cto = *cfrom;
55 return xto;
56 #else
57 const char *c_from = from;
58 char *c_to = to;
59 while (n-- > 0)
60 *c_to++ = *c_from++;
61 return((void *) to);
62 #endif