home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / text / hyper / ADtoHT2_0.lha / MyLib.lha / string / memcmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-14  |  492 b   |  36 lines

  1. #include <string.h>
  2.  
  3. /************************************************************************/
  4.  
  5. #undef memcmp
  6.  
  7. #if defined(__SASC_510)
  8.  
  9. int memcmp(const void *s1, const void *s2, size_t n)
  10.  
  11. {
  12.   return __builtin_memcmp(s1,s2,n);
  13. }
  14.  
  15. #else
  16.  
  17. int memcmp(const void *s1, const void *s2, size_t n)
  18.  
  19. {
  20.   int r=0;
  21.  
  22.   if (n != 0)
  23.     {
  24.       const unsigned char *c1;
  25.       const unsigned char *c2;
  26.  
  27.       c1=s1;
  28.       c2=s2;
  29.       while (!(r=*c1++-*c2++) && (--n != 0))
  30.     ;
  31.     }
  32.   return r;
  33. }
  34.  
  35. #endif
  36.