aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/lib/memcpy.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/m68knommu/lib/memcpy.c
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/m68knommu/lib/memcpy.c')
-rw-r--r--arch/m68knommu/lib/memcpy.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/m68knommu/lib/memcpy.c b/arch/m68knommu/lib/memcpy.c
new file mode 100644
index 00000000000..0d5577569e4
--- /dev/null
+++ b/arch/m68knommu/lib/memcpy.c
@@ -0,0 +1,63 @@
1
2#include <linux/types.h>
3#include <linux/autoconf.h>
4
5void * memcpy(void * to, const void * from, size_t n)
6{
7#ifdef CONFIG_COLDFIRE
8 void *xto = to;
9 size_t temp;
10
11 if (!n)
12 return xto;
13 if ((long) to & 1)
14 {
15 char *cto = to;
16 const char *cfrom = from;
17 *cto++ = *cfrom++;
18 to = cto;
19 from = cfrom;
20 n--;
21 }
22 if (n > 2 && (long) to & 2)
23 {
24 short *sto = to;
25 const short *sfrom = from;
26 *sto++ = *sfrom++;
27 to = sto;
28 from = sfrom;
29 n -= 2;
30 }
31 temp = n >> 2;
32 if (temp)
33 {
34 long *lto = to;
35 const long *lfrom = from;
36 for (; temp; temp--)
37 *lto++ = *lfrom++;
38 to = lto;
39 from = lfrom;
40 }
41 if (n & 2)
42 {
43 short *sto = to;
44 const short *sfrom = from;
45 *sto++ = *sfrom++;
46 to = sto;
47 from = sfrom;
48 }
49 if (n & 1)
50 {
51 char *cto = to;
52 const char *cfrom = from;
53 *cto = *cfrom;
54 }
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
63}