2001-03-30 H.J. Lu <hjl@gnu.org>
[binutils.git] / libiberty / bcmp.c
blob11e4417db159e4e234b5389a2f57c4165dba7a34
1 /* bcmp
2 This function is in the public domain. */
4 /*
6 NAME
8 bcmp -- compare two memory regions
10 SYNOPSIS
12 int bcmp (char *from, char *to, int count)
14 DESCRIPTION
16 Compare two memory regions and return zero if they are identical,
17 non-zero otherwise. If count is zero, return zero.
19 NOTES
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.
27 BUGS
32 int
33 bcmp (from, to, count)
34 char *from, *to;
35 int count;
37 int rtnval = 0;
39 while (count-- > 0)
41 if (*from++ != *to++)
43 rtnval = 1;
44 break;
47 return (rtnval);