summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/dfs/filesystems/elmfat/ff.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/components/dfs/filesystems/elmfat/ff.c b/components/dfs/filesystems/elmfat/ff.c
index f6b85c30c8..e967bc76d7 100644
--- a/components/dfs/filesystems/elmfat/ff.c
+++ b/components/dfs/filesystems/elmfat/ff.c
@@ -522,7 +522,14 @@ void mem_cpy (void* dst, const void* src, UINT cnt) {
BYTE *d = (BYTE*)dst;
const BYTE *s = (const BYTE*)src;
-#if _WORD_ACCESS == 1
+#if _WORD_ACCESS == 1
+ if (((unsigned)d & 0x03)!=0 || ((unsigned)s & 0x03)!=0)
+ {
+ while (cnt--)
+ *d++ = *s++;
+ return;
+ }
+
while (cnt >= sizeof(int)) {
*(int*)d = *(int*)s;
d += sizeof(int); s += sizeof(int);