os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/compat/memcmp.c
First public contribution.
4 * Source code for the "memcmp" library routine.
6 * Copyright (c) 1998 Sun Microsystems, Inc.
8 * See the file "license.terms" for information on usage and redistribution
9 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 * SCCS: @(#) memcmp.c 1.2 98/01/19 10:48:58
18 * Here is the prototype just in case it is not included
22 int memcmp _ANSI_ARGS_((CONST VOID *s1,
23 CONST VOID *s2, size_t n));
26 *----------------------------------------------------------------------
30 * Compares two bytes sequences.
33 * compares its arguments, looking at the first n
34 * bytes (each interpreted as an unsigned char), and returns
35 * an integer less than, equal to, or greater than 0, accord-
36 * ing as s1 is less than, equal to, or
37 * greater than s2 when taken to be unsigned 8 bit numbers.
42 *----------------------------------------------------------------------
47 CONST VOID *s1; /* First string. */
48 CONST VOID *s2; /* Second string. */
49 size_t n; /* Length to compare. */
51 CONST unsigned char *ptr1 = (CONST unsigned char *) s1;
52 CONST unsigned char *ptr2 = (CONST unsigned char *) s2;
54 for ( ; n-- ; ptr1++, ptr2++) {
55 unsigned char u1 = *s1, u2 = *s2;