From 333179e1c565d9d7b9ed970d806b04544e0b634c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 27 May 2012 16:06:23 +0200 Subject: [PATCH] software/libbase: memcpy: same with 2 alignment --- software/libbase/libc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/software/libbase/libc.c b/software/libbase/libc.c index d0667f1cd..16aac09a5 100644 --- a/software/libbase/libc.c +++ b/software/libbase/libc.c @@ -280,6 +280,21 @@ void *memcpy(void *to, const void *from, size_t n) from = sfrom; n -= 2; } + if((long)from & 2) { + short *sto = to; + const short *sfrom = from; + temp = n >> 1; + for (; temp; temp--) + *sto++ = *sfrom++; + to = sto; + from = sfrom; + if(n & 1) { + char *cto = to; + const char *cfrom = from; + *cto = *cfrom; + } + return xto; + } temp = n >> 2; if(temp) { long *lto = to;