MIPS: SB1250: Include correct header and fix a warning
[linux-2.6/linux-mips.git] / arch / m68knommu / lib / memcpy.c
blobb50dbcad47464534688b7414997d488e4ba721bd
2 #include <linux/types.h>
4 void * memcpy(void * to, const void * from, size_t n)
6 #ifdef CONFIG_COLDFIRE
7 void *xto = to;
8 size_t temp;
10 if (!n)
11 return xto;
12 if ((long) to & 1)
14 char *cto = to;
15 const char *cfrom = from;
16 *cto++ = *cfrom++;
17 to = cto;
18 from = cfrom;
19 n--;
21 if (n > 2 && (long) to & 2)
23 short *sto = to;
24 const short *sfrom = from;
25 *sto++ = *sfrom++;
26 to = sto;
27 from = sfrom;
28 n -= 2;
30 temp = n >> 2;
31 if (temp)
33 long *lto = to;
34 const long *lfrom = from;
35 for (; temp; temp--)
36 *lto++ = *lfrom++;
37 to = lto;
38 from = lfrom;
40 if (n & 2)
42 short *sto = to;
43 const short *sfrom = from;
44 *sto++ = *sfrom++;
45 to = sto;
46 from = sfrom;
48 if (n & 1)
50 char *cto = to;
51 const char *cfrom = from;
52 *cto = *cfrom;
54 return xto;
55 #else
56 const char *c_from = from;
57 char *c_to = to;
58 while (n-- > 0)
59 *c_to++ = *c_from++;
60 return((void *) to);
61 #endif