xref: /original-bsd/lib/libc/string/bcmp.c (revision b366b3c1)
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.7 (Berkeley) 10/04/92";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <string.h>
13 
14 /*
15  * bcmp -- vax cmpc3 instruction
16  */
17 int
18 bcmp(b1, b2, length)
19 	const void *b1, *b2;
20 	register size_t length;
21 {
22 	register char *p1, *p2;
23 
24 	if (length == 0)
25 		return(0);
26 	p1 = (char *)b1;
27 	p2 = (char *)b2;
28 	do
29 		if (*p1++ != *p2++)
30 			break;
31 	while (--length);
32 	return(length);
33 }
34