Skip to content

Commit

Permalink
software/libbase: fix memcpy handling of buffers with differing align…
Browse files Browse the repository at this point in the history
…ments
Sebastien Bourdeauducq committed May 27, 2012
1 parent 4dbc938 commit 48b70f0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion software/libbase/libc.c
Original file line number Diff line number Diff line change
@@ -265,6 +265,13 @@ void *memcpy(void *to, const void *from, size_t n)
from = cfrom;
n--;
}
if((long)from & 1) {
char *cto = to;
const char *cfrom = from;
for (; n; n--)
*cto++ = *cfrom++;
return xto;
}
if(n > 2 && (long)to & 2) {
short *sto = to;
const short *sfrom = from;
@@ -278,7 +285,7 @@ void *memcpy(void *to, const void *from, size_t n)
long *lto = to;
const long *lfrom = from;
for(; temp; temp--)
*lto++ = *lfrom++;
*lto++ = *lfrom++;
to = lto;
from = lfrom;
}

0 comments on commit 48b70f0

Please sign in to comment.