home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / gcc / libnixV0_8.lha / gnu / libnix-sources.lha / sources / nix / string / memcmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-12  |  264 b   |  17 lines

  1. #include <string.h>
  2.  
  3. int memcmp(const void *s1,const void *s2,size_t n)
  4. {
  5.   int r=0;
  6.  
  7.   if (n != 0)
  8.   {
  9.     unsigned char *c1=(unsigned char *)s1;
  10.     unsigned char *c2=(unsigned char *)s2;
  11.     
  12.     while (!(r=*c1++-*c2++) && (--n != 0))
  13.       ;
  14.   }
  15.   return r;
  16. }
  17.