Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  2. #include <string.h>
  3. #include <assert.h>
  4.  
  5. int
  6. memcmp(const void *s1, const void *s2, size_t n)
  7. {
  8.   if (n != 0)
  9.   {
  10.     const unsigned char *p1 = s1, *p2 = s2;
  11.  
  12.     do {
  13.       if (*p1++ != *p2++)
  14.         return (*--p1 - *--p2);
  15.     } while (--n != 0);
  16.   }
  17.   return 0;
  18. }
  19.