"Fossies" - the Fresh Open Source Software Archive

Member "pktstat-1.8.5/memcmp.c" (27 Jan 2006, 352 Bytes) of package /linux/privat/old/pktstat-1.8.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* 2006, David Leonard. Public domain */
    2 #if HAVE_CONFIG_H
    3 # include <config.h>
    4 #endif
    5 
    6 #include "compat.h"
    7 
    8 int
    9 memcmp(pa, pb, len)
   10     void *pa, *pb;
   11     size_t len;
   12 {
   13     unsigned char *a = (unsigned char *)pa;
   14     unsigned char *b = (unsigned char *)pb;
   15 
   16     while (len--)
   17         if (*a == *b)
   18             a++, b++;
   19         else 
   20         return *a < *b ? -1 : 1;
   21     return 0;
   22 }
   23