From: John Hodge Date: Sun, 4 Jul 2010 05:47:32 +0000 (+0800) Subject: Cleaning up a little, and possibly a speed increase X-Git-Tag: rel0.06~116 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=c2c7967425324c3e631487ed100de7f3a736203f;p=tpg%2Facess2.git Cleaning up a little, and possibly a speed increase --- diff --git a/Kernel/arch/x86/lib.c b/Kernel/arch/x86/lib.c index 7fa666fa..6522574f 100644 --- a/Kernel/arch/x86/lib.c +++ b/Kernel/arch/x86/lib.c @@ -54,11 +54,14 @@ Uint32 ind(Uint16 Port) */ void *memset(void *Dest, int Val, size_t Num) { + Uint32 val = Val&0xFF; + val |= val << 8; + val |= val << 16; __asm__ __volatile__ ( "rep stosl;\n\t" "mov %3, %%ecx;\n\t" "rep stosb" - :: "D" (Dest), "a" (Val), "c" (Num/4), "r" (Num&3)); + :: "D" (Dest), "a" (val), "c" (Num/4), "r" (Num&3)); return Dest; } /** @@ -91,7 +94,7 @@ int memcmp(const void *m1, const void *m2, size_t Num) */ void *memcpy(void *Dest, const void *Src, size_t Num) { - if((Uint)Dest & 3 || (Uint)Src & 3) + if( ((Uint)Dest & 3) || ((Uint)Src & 3) ) __asm__ __volatile__ ("rep movsb" :: "D" (Dest), "S" (Src), "c" (Num)); else { __asm__ __volatile__ (