source: trunk/packages/xen-3.1/xen-3.1/xen/arch/powerpc/of_handler/memcmp.c @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 1.1 KB
Line 
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
15 *
16 * Copyright (C) IBM Corp. 2005
17 *
18 * Authors: Jimi Xenidis <jimix@watson.ibm.com>
19 */
20
21#include <xen/string.h>
22
23int
24memcmp(const void *v1, const void *v2, size_t n)
25{
26    const char *s1 = (const char *)v1;
27    const char *s2 = (const char *)v2;
28
29    while (n > 0) {
30        if (*s1 != *s2) {
31            return (*s1 - *s2);
32        }
33        /* advance pointers to next character */
34        ++s1;
35        ++s2;
36        --n;
37    }
38    return 0;
39}
Note: See TracBrowser for help on using the repository browser.