Back to index

cell-binutils  2.17cvs20070401
Functions
memcmp.c File Reference
#include <ansidecl.h>
#include <stddef.h>

Go to the source code of this file.

Functions

int memcmp (const PTR str1, const PTR str2, size_t count)

Function Documentation

int memcmp ( const PTR  str1,
const PTR  str2,
size_t  count 
)

Definition at line 22 of file memcmp.c.

{
  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;
}