|
From: Kenn H. <ke...@us...> - 2004-10-04 23:00:05
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/boot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29852/arch/vax/boot Modified Files: lib.c Log Message: Speed up boot_memmove Index: lib.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/lib.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- lib.c 30 Sep 2004 05:31:04 -0000 1.6 +++ lib.c 4 Oct 2004 22:59:51 -0000 1.7 @@ -78,18 +78,53 @@ void __boot boot_memmove(void *dest, const void *src, size_t count) { - char *tmp, *s; + char *d, *s; + int *di; + int *si; if (dest <= src) { - tmp = (char *) dest; - s = (char *) src; - while (count--) - *tmp++ = *s++; + si = (int *) src; + di = (int *) dest; + + while (count & ~3) { + *di++ = *si++; + count -= 4; + } + d = (char *) di; + s = (char *) si; + + if (count & 2) { + *d++ = *s++; + *d++ = *s++; + count ++; + count ++; + } + + if (count & 1) { + *d++ = *s++; + count ++; + } + } else { - tmp = (char *) dest + count; + d = (char *) dest + count; s = (char *) src + count; - while (count--) - *--tmp = *--s; + + if (count & 1) { + *--d = *--s; + count--; + } + + if (count & 2) { + *--d = *--s; + *--d = *--s; + count--; + count--; + } + + si = (int *) s; + di = (int *) d; + while (count -= 4) + *--di = *--si; } } |