xref: /original-bsd/lib/libc/string/bcmp.c (revision 50dd0bba)
1 /*
2  * Copyright (c) 1987 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)bcmp.c	5.6 (Berkeley) 02/24/91";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <string.h>
13 
14 /*
15  * bcmp -- vax cmpc3 instruction
16  */
17 bcmp(b1, b2, length)
18 	const void *b1, *b2;
19 	register size_t length;
20 {
21 	register char *p1, *p2;
22 
23 	if (length == 0)
24 		return(0);
25 	p1 = (char *)b1;
26 	p2 = (char *)b2;
27 	do
28 		if (*p1++ != *p2++)
29 			break;
30 	while (--length);
31 	return(length);
32 }
33