xref: /csrg-svn/lib/libc/string/memcmp.c (revision 34479)
124195Skre /*
224195Skre  * Copyright (c) 1985 Regents of the University of California.
3*34479Sbostic  * All rights reserved.
4*34479Sbostic  *
5*34479Sbostic  * Redistribution and use in source and binary forms are permitted
6*34479Sbostic  * provided that this notice is preserved and that due credit is given
7*34479Sbostic  * to the University of California at Berkeley. The name of the University
8*34479Sbostic  * may not be used to endorse or promote products derived from this
9*34479Sbostic  * software without specific written prior permission. This software
10*34479Sbostic  * is provided ``as is'' without express or implied warranty.
1124195Skre  */
1224195Skre 
1326527Sdonn #if defined(LIBC_SCCS) && !defined(lint)
14*34479Sbostic static char sccsid[] = "@(#)memcmp.c	5.3 (Berkeley) 05/25/88";
15*34479Sbostic #endif /* LIBC_SCCS and not lint */
1624195Skre 
1724195Skre memcmp(s1, s2, n)
1824195Skre 	register char *s1, *s2;
1924195Skre 	register n;
2024195Skre {
2124195Skre 	while (--n >= 0)
2224195Skre 		if (*s1++ != *s2++)
2324195Skre 			return (*--s1 - *--s2);
2424195Skre 	return (0);
2524195Skre }
26