Annotation of researchv10no/cmd/u9fs/memmove.c, revision 1.1

1.1     ! root        1: #include "u.h"
        !             2: #include <sys/types.h>
        !             3: #include <sys/stat.h>
        !             4: #include "libc.h"
        !             5: 
        !             6: /*
        !             7:  * Portable version for systems from the ancien regime
        !             8:  */
        !             9: 
        !            10: void*
        !            11: memmove(void *a1, void *a2, Ulong n)
        !            12: {
        !            13:        char *s1, *s2;
        !            14: 
        !            15:        if(a1 > a2)
        !            16:                goto back;
        !            17:        s1 = a1;
        !            18:        s2 = a2;
        !            19:        while(n > 0) {
        !            20:                *s1++ = *s2++;
        !            21:                n--;
        !            22:        }
        !            23:        return a1;
        !            24: 
        !            25: back:
        !            26:        s1 = (char*)a1 + n;
        !            27:        s2 = (char*)a2 + n;
        !            28:        while(n > 0) {
        !            29:                *--s1 = *--s2;
        !            30:                n--;
        !            31:        }
        !            32:        return a1;
        !            33: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.