/*
 * memcmp - compare bytes
 */

#include "config.h"

int                             /* <0, == 0, >0 */
memcmp(s1, s2, size)
CONST VOIDSTAR s1;
CONST VOIDSTAR s2;
SIZET size;
{
        register CONST char *scan1;
        register CONST char *scan2;
        register SIZET n;

        scan1 = s1;
        scan2 = s2;
        for (n = size; n > 0; n--)
                if (*scan1 == *scan2) {
                        scan1++;
                        scan2++;
                } else
                        return(*scan1 - *scan2);

        return(0);
}

/*
 - bcmp - Berklix equivalent of memcmp
 */

int                             /* == 0 or != 0 for equality and inequality */
bcmp(s1, s2, length)
CONST char *s1;
CONST char *s2;
int length;
{
        return(memcmp((CONST VOIDSTAR)s1, (CONST VOIDSTAR)s2, (SIZET)length));
}

