File:  [DVB] / dietlibc / lib / memcmp.c
Revision 1.6: download - view: text, annotated - select for diffs
Tue Mar 15 08:51:22 2005 UTC (19 years, 2 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
  Lots of fixes and patches from Markus Oberhumer.
    libstdc++ compatibility
    ilp64 compatibility
    make diet libc compile with -Werror on 13 platforms
  ppc64 now compiles again

#include <sys/types.h>
#include <string.h>

/* gcc is broken and has a non-SUSv2 compliant internal prototype.
 * This causes it to warn about a type mismatch here.  Ignore it. */
int memcmp(const void *dst, const void *src, size_t count) {
  register int r;
  register const unsigned char *d=dst;
  register const unsigned char *s=src;
  ++count;
  while (__likely(--count)) {
    if (__unlikely(r=(*d - *s)))
      return r;
    ++d;
    ++s;
  }
  return 0;
}

int bcmp(const char *a,const char *b,size_t c)	__attribute__((weak,alias("memcmp")));

LinuxTV legacy CVS <linuxtv.org/cvs>