OSDN Git Service

Date: Sun, 20 Dec 1998 22:07:16 -0700
[pf3gnuchains/gcc-fork.git] / libiberty / bcmp.c
1 /* bcmp
2    This function is in the public domain.  */
3
4 /*
5
6 NAME
7
8         bcmp -- compare two memory regions
9
10 SYNOPSIS
11
12         int bcmp (char *from, char *to, int count)
13
14 DESCRIPTION
15
16         Compare two memory regions and return zero if they are identical,
17         non-zero otherwise.  If count is zero, return zero.
18
19 NOTES
20
21         No guarantee is made about the non-zero returned value.  In
22         particular, the results may be signficantly different than
23         strcmp(), where the return value is guaranteed to be less than,
24         equal to, or greater than zero, according to lexicographical
25         sorting of the compared regions.
26
27 BUGS
28
29 */
30
31
32 int
33 bcmp (from, to, count)
34   char *from, *to;
35   int count;
36 {
37   int rtnval = 0;
38
39   while (count-- > 0)
40     {
41       if (*from++ != *to++)
42         {
43           rtnval = 1;
44           break;
45         }
46     }
47   return (rtnval);
48 }
49