add Berkeley specific copyright
[unix-history] / usr / src / lib / libc / string / bcopy.c
CommitLineData
dba1d438
KM
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)
8static char sccsid[] = "@(#)bcopy.c 5.1 (Berkeley) %G%";
9#endif LIBC_SCCS and not lint
10
11/*
12 * bcopy -- vax movc3 instruction
13 */
14bcopy(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}