[net.sources] Speedup to bcopy

root (07/13/82)

We did some local monitoring, and discovered that bcopy() always copies
an even number of bytes (i.e. words) always starting on a word boundary.
Doing a byte copy is wasteful compared to a word copy, so we implemented
the following change. Note that it tests for byte boundaries all the same,
since just 'cuz we never saw it happen doesn't mean somebody might not
copy odd bytes or odd addresses (although we doubt it). Anyway, bcopy
gets called an AWFUL lot, so this should speed things up a bit for you
overloaded folks. (We are running BSD something-or-other).

			-Dan Klein & Tron McConnell

-------------------------------------------------------------------------
/*
 * copy count bytes from from to to.
 */
bcopy(from, to, count)
caddr_t from, to;
register count;
{

#ifdef MI_BCOPY
	if ((count|from|to)&1) {	/* RARE case of odd bytes */
#endif
		register char *f, *t;
		f = from;
		t = to;
		do
			*t++ = *f++;
		while(--count);
#ifdef MI_BCOPY
	} else {
		register int *f, *t;
		f = from;
		t = to;
		count >>= 1;		/* Quick divide by 2 */
		do
			*t++ = *f++;
		while(--count);
	}
#endif
}