2 * Mach Operating System
3 * Copyright (c) 1992,1991,1990,1989 Carnegie Mellon University
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16 * Carnegie Mellon requests users of this software to return to
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
27 * File: limach/memcmp.c
28 * Author: Robert V. Baron at Carnegie Mellon
31 * strcmp (s1, s2) compares the strings "s1" and "s2".
32 * It returns 0 if the strings are identical. It returns
33 * > 0 if the first character that differs into two strings
34 * is larger in s1 than in s2 or if s1 is longer than s2 and
35 * the contents are identical up to the length of s2.
36 * It returns < 0 if the first differing character is smaller
37 * in s1 than in s2 or if s1 is shorter than s2 and the
38 * contents are identical upto the length of s1.
43 int memcmp(const void *s1v, const void *s2v, size_t size);
46 memcmp(const void *s1v, const void *s2v, size_t size)
48 register const char *s1 = s1v, *s2 = s2v;
49 register unsigned int a, b;
52 if ((a = *s1++) != (b = *s2++))