Kernel - memmove improved (but with an assumption)
authorJohn Hodge <[email protected]>
Fri, 21 Oct 2011 01:27:45 +0000 (09:27 +0800)
committerJohn Hodge <[email protected]>
Fri, 21 Oct 2011 01:27:45 +0000 (09:27 +0800)
Kernel/lib.c

index 4d65108..6263dc8 100644 (file)
@@ -966,6 +966,10 @@ void *memmove(void *__dest, const void *__src, size_t len)
        if( (tVAddr)dest + len < (tVAddr)src )
                return memcpy(dest, src, len);
        
+       // NOTE: Assumes memcpy works forward
+       if( (tVAddr)dest < (tVAddr)src )
+               return memcpy(dest, src, len);
+
        if( (tVAddr)dest < (tVAddr)src )
                block_size = (tVAddr)src - (tVAddr)dest;
        else

UCC git Repository :: git.ucc.asn.au