Permalink
Switch branches/tags
snapshots/gcc-4.8-20120701 snapshots/gcc-4.8-20120624 snapshots/gcc-4.8-20120617 snapshots/gcc-4.8-20120610 snapshots/gcc-4.8-20120603 snapshots/gcc-4.8-20120527 snapshots/gcc-4.8-20120520 snapshots/gcc-4.8-20120513 snapshots/gcc-4.8-20120506 snapshots/gcc-4.8-20120429 snapshots/gcc-4.8-20120422 snapshots/gcc-4.8-20120415 snapshots/gcc-4.8-20120408 snapshots/gcc-4.8-20120401 snapshots/gcc-4.8-20120325 snapshots/gcc-4.8-20120318 snapshots/gcc-4.8-20120311 snapshots/gcc-4.8-20120304 snapshots/gcc-4.8-20120302 snapshots/gcc-4.7.1-RC-20120606 snapshots/gcc-4.7.0-RC-20120314 snapshots/gcc-4.7.0-RC-20120302 snapshots/gcc-4.7-20120707 snapshots/gcc-4.7-20120630 snapshots/gcc-4.7-20120623 snapshots/gcc-4.7-20120616 snapshots/gcc-4.7-20120609 snapshots/gcc-4.7-20120602 snapshots/gcc-4.7-20120526 snapshots/gcc-4.7-20120519 snapshots/gcc-4.7-20120512 snapshots/gcc-4.7-20120505 snapshots/gcc-4.7-20120428 snapshots/gcc-4.7-20120421 snapshots/gcc-4.7-20120414 snapshots/gcc-4.7-20120407 snapshots/gcc-4.7-20120331 snapshots/gcc-4.7-20120324 snapshots/gcc-4.7-20120225 snapshots/gcc-4.7-20120218 snapshots/gcc-4.7-20120211 snapshots/gcc-4.7-20120204 snapshots/gcc-4.7-20120128 snapshots/gcc-4.7-20120121 snapshots/gcc-4.7-20120114 snapshots/gcc-4.7-20120107 snapshots/gcc-4.7-20111231 snapshots/gcc-4.7-20111224 snapshots/gcc-4.7-20111217 snapshots/gcc-4.7-20111210 snapshots/gcc-4.7-20111203 snapshots/gcc-4.7-20111126 snapshots/gcc-4.7-20111119 snapshots/gcc-4.7-20111112 snapshots/gcc-4.7-20111105 snapshots/gcc-4.7-20111029 snapshots/gcc-4.7-20111022 snapshots/gcc-4.7-20111015 snapshots/gcc-4.7-20111008 snapshots/gcc-4.7-20111001 snapshots/gcc-4.7-20110924 snapshots/gcc-4.7-20110917 snapshots/gcc-4.7-20110910 snapshots/gcc-4.7-20110903 snapshots/gcc-4.7-20110827 snapshots/gcc-4.7-20110820 snapshots/gcc-4.7-20110813 snapshots/gcc-4.7-20110806 snapshots/gcc-4.7-20110730 snapshots/gcc-4.7-20110723 snapshots/gcc-4.7-20110716 snapshots/gcc-4.7-20110709 snapshots/gcc-4.7-20110702 snapshots/gcc-4.7-20110625 snapshots/gcc-4.7-20110618 snapshots/gcc-4.7-20110611 snapshots/gcc-4.7-20110604 snapshots/gcc-4.7-20110528 snapshots/gcc-4.7-20110521 snapshots/gcc-4.7-20110514 snapshots/gcc-4.7-20110507 snapshots/gcc-4.7-20110430 snapshots/gcc-4.7-20110423 snapshots/gcc-4.7-20110416 snapshots/gcc-4.7-20110409 snapshots/gcc-4.7-20110402 snapshots/gcc-4.6.3-RC-20120223 snapshots/gcc-4.6.2-RC-20111019 snapshots/gcc-4.6.1-RC-20110620 snapshots/gcc-4.6-20120706 snapshots/gcc-4.6-20120629 snapshots/gcc-4.6-20120622 snapshots/gcc-4.6-20120615 snapshots/gcc-4.6-20120608 snapshots/gcc-4.6-20120601 snapshots/gcc-4.6-20120525 snapshots/gcc-4.6-20120518 snapshots/gcc-4.6-20120511 snapshots/gcc-4.6-20120504 snapshots/gcc-4.6-20120427
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (26 sloc) 876 Bytes
/* memcmp -- compare two memory regions.
This function is in the public domain. */
/*
@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, @
size_t @var{count})
Compares the first @var{count} bytes of two areas of memory. Returns
zero if they are the same, a value less than zero if @var{x} is
lexically less than @var{y}, or a value greater than zero if @var{x}
is lexically greater than @var{y}. Note that lexical order is determined
as if comparing unsigned char arrays.
@end deftypefn
*/
#include <ansidecl.h>
#include <stddef.h>
int
memcmp (const PTR str1, const PTR str2, size_t count)
{
register const unsigned char *s1 = (const unsigned char*)str1;
register const unsigned char *s2 = (const unsigned char*)str2;
while (count-- > 0)
{
if (*s1++ != *s2++)
return s1[-1] < s2[-1] ? -1 : 1;
}
return 0;
}