File:  [Research Unix] / researchv10no / cmd / asd++ / checksum.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

#include "decl.h"

checksum::
checksum()
{
	bufend = buf + cksize;
	bufptr = buf;
	char *p = buf;
	while (p < bufend)
		*p++ = '?';
}

void checksum::
combine (char* adr, int len)
{
	register char *p = bufptr, *q = adr;
	register int n = len;

	while (--n >= 0) {
		*p++ ^= *q++;
		if (p >= bufend)
			p = buf;
	}

	bufptr = p;
}

int checksum::
operator== (checksum& c)
{
	register int n = cksize;

	while (--n >= 0) {
		if (buf[n] != c.buf[n])
			return 0;
	}
	return 1;
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.