/*
   Bcmp, bcmpl, memcmp, and memcmpl.
   
   See COPYLEFT.JRD.
*/

asm (".text");
asm (".even\n.globl _memcmp\n_memcmp:");

#ifdef __GNUC__
/* doing things right, 32-bit ints? ok, just do it this way... */
asm (".text");
asm (".even\n.globl _bcmp\n_bcmp:");
#else
int bcmp(buf1, buf2, nbytes)
char * buf1;
char * buf2;
int nbytes;
{
  bcmpl(buf1, buf2, nbytes);
}
#endif

asm (".text");
asm (".even\n.globl _memcmpl\n_memcmpl:");

int bcmpl(buf1, buf2, nbytes)
char * buf1;
char * buf2;
long nbytes;
{
  int diff;
  
  for ( ; nbytes > 0 ; --nbytes)
	if (diff = (*buf1++ - *buf2++))
		return(diff);
  return(0);
}
