#ifndef XPKMASTER_CHECKSUM_C
#define XPKMASTER_CHECKSUM_C

/* Routinesheader

	Name:		checksum.c
	Main:		xpkmaster
	Versionstring:	$VER: checksum.c 1.0 (05.10.96)
	Author:		SDI
	Distribution:	PD
	Description:	Simple checksum routines

 1.0   05.10.96 : first real version
*/

#include <exec/types.h>

UBYTE hchecksum(STRPTR ptr, ULONG count)
{
  register UBYTE sum = 0;

  while(count-- > 0)
    sum ^= *ptr++;

  return sum;
}

UWORD cchecksum(ULONG *ptr, ULONG count)
{
  register ULONG sum = 0;

  while(count-- > 0)
    sum ^= *ptr++;

  return (UWORD) ((sum ^ (sum >> 16)) & 0xffff);
}

#endif /* XPKMASTER_CHECKSUM_C */
