/* Copyright (C) Magna Carta Software, Inc. 1990. All Rights Reserved C COMMUNICATIONS TOOLKIT v1.0 CHECKSUM.C -- ROUTINES TO CALCULATE CHECKSUMS. */ #if !defined(TYPES_DEFINED) typedef unsigned char BYTE; typedef unsigned short WORD; #define TYPES_DEFINED #endif /* #define checksum(a, b) (a)+=(b) */ WORD checksum(WORD accum, WORD ch) { return (accum += ch); } /* CHECKSUMN -- Compute the checksum of a buffer starting at "buf" and extending for "count" characters. */ WORD checksumn(char *buf, WORD count) { WORD chk; for(chk=0; count > 0; count--) chk += *buf++; return (chk); }