Annotation of researchv10no/cmd/cfront/libstring/Memcpy.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copy s2 to s1, always copy n bytes
                      3:  * return s1
                      4:  *
                      5:  * JES 7Aug81 Allow overlapping moves in either direction.
                      6:  */
                      7: 
                      8: /* eventually do this in machine language */
                      9: extern char *
                     10: Memcpy(register char *s1, register const char *s2, int n)
                     11: {
                     12:        char *  os1 = s1;
                     13:        register char * ns;
                     14: 
                     15:        if (s1 <= s2) {
                     16:                ns = s1 + n;  /* stopper for s1 */
                     17:                while ( s1 < ns )
                     18:                        *s1++ = *s2++;
                     19:        } else {
                     20:                ns = s1;
                     21:                s1 += n;
                     22:                s2 += n;
                     23:                while ( ns < s1 )
                     24:                        *--s1 = *--s2;
                     25:        }
                     26:        return(os1);
                     27: }
                     28: 

unix.superglobalmegacorp.com

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