diff options
| author | [email protected] <[email protected]> | 2012-07-30 13:39:11 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-07-30 13:39:11 +0000 |
| commit | 0919b8dab184ce36e6ae2db9d6938bdc372edae5 (patch) | |
| tree | 4b05f6893cc4d4bf993d8839dfa7adedbb5f5492 /components/dfs | |
| parent | 03de4f8a482e846388c90e540945c8c74386e5e1 (diff) | |
fix non-align bug in the mem_cpy
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2239 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/dfs')
| -rw-r--r-- | components/dfs/filesystems/elmfat/ff.c | 9 |
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); |
