Annotation of 43BSDTahoe/lib/libc/gen/bcopy.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1987 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  */
        !             6: 
        !             7: #if defined(LIBC_SCCS) && !defined(lint)
        !             8: static char sccsid[] = "@(#)bcopy.c    5.1 (Berkeley) 1/27/87";
        !             9: #endif LIBC_SCCS and not lint
        !            10: 
        !            11: /*
        !            12:  * bcopy -- vax movc3 instruction
        !            13:  */
        !            14: bcopy(src, dst, length)
        !            15:        register char *src, *dst;
        !            16:        register int length;
        !            17: {
        !            18:        if (length && src != dst)
        !            19:                if ((u_int)dst < (u_int)src)
        !            20:                        if (((int)src | (int)dst | length) & 3)
        !            21:                                do      /* copy by bytes */
        !            22:                                        *dst++ = *src++;
        !            23:                                while (--length);
        !            24:                        else {
        !            25:                                length >>= 2;
        !            26:                                do      /* copy by longs */
        !            27:                                        *((long *)dst)++ = *((long *)src)++;
        !            28:                                while (--length);
        !            29:                        }
        !            30:                else {                  /* copy backwards */
        !            31:                        src += length;
        !            32:                        dst += length;
        !            33:                        if (((int)src | (int)dst | length) & 3)
        !            34:                                do      /* copy by bytes */
        !            35:                                        *--dst = *--src;
        !            36:                                while (--length);
        !            37:                        else {
        !            38:                                length >>= 2;
        !            39:                                do      /* copy by shorts */
        !            40:                                        *--((long *)dst) = *--((long *)src);
        !            41:                                while (--length);
        !            42:                        }
        !            43:                }
        !            44:        return(0);
        !            45: }

unix.superglobalmegacorp.com

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