xref: /netbsd-src/external/gpl3/binutils/dist/libiberty/bcmp.c (revision 2a6b7db32dd0fcd096655620989789704fbe4a7d)
1*2a6b7db3Sskrll /* bcmp
2*2a6b7db3Sskrll    This function is in the public domain.  */
3*2a6b7db3Sskrll 
4*2a6b7db3Sskrll /*
5*2a6b7db3Sskrll 
6*2a6b7db3Sskrll @deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count})
7*2a6b7db3Sskrll 
8*2a6b7db3Sskrll Compares the first @var{count} bytes of two areas of memory.  Returns
9*2a6b7db3Sskrll zero if they are the same, nonzero otherwise.  Returns zero if
10*2a6b7db3Sskrll @var{count} is zero.  A nonzero result only indicates a difference,
11*2a6b7db3Sskrll it does not indicate any sorting order (say, by having a positive
12*2a6b7db3Sskrll result mean @var{x} sorts before @var{y}).
13*2a6b7db3Sskrll 
14*2a6b7db3Sskrll @end deftypefn
15*2a6b7db3Sskrll 
16*2a6b7db3Sskrll */
17*2a6b7db3Sskrll 
18*2a6b7db3Sskrll #include <stddef.h>
19*2a6b7db3Sskrll 
20*2a6b7db3Sskrll extern int memcmp(const void *, const void *, size_t);
21*2a6b7db3Sskrll 
22*2a6b7db3Sskrll int
bcmp(const void * s1,const void * s2,size_t count)23*2a6b7db3Sskrll bcmp (const void *s1, const void *s2, size_t count)
24*2a6b7db3Sskrll {
25*2a6b7db3Sskrll   return memcmp (s1, s2, count);
26*2a6b7db3Sskrll }
27*2a6b7db3Sskrll 
28