home *** CD-ROM | disk | FTP | other *** search
- #ifndef XPKMASTER_CHECKSUM_C
- #define XPKMASTER_CHECKSUM_C
-
- /* Routinesheader
-
- Name: checksum.c
- Main: xpkmaster
- Versionstring: $VER: checksum.c 1.3 (09.01.1998)
- Author: SDI
- Distribution: Freeware
- Description: Simple checksum routines
-
- 1.0 05.10.96 : first real version
- 1.1 30.01.97 : added new option to cchecksum, became necessary
- 1.2 31.01.97 : removed new option
- 1.3 09.01.98 : added XPK_ALLINONE
- */
-
- #include <exec/types.h>
- #include "xpkmaster.h"
-
- XPK_ALLINONE UBYTE hchecksum(STRPTR ptr, ULONG count)
- {
- register UBYTE sum = 0;
-
- while(count-- > 0)
- sum ^= *ptr++;
-
- return sum;
- }
-
- XPK_ALLINONE UWORD cchecksum(ULONG *ptr, ULONG count)
- {
- register ULONG sum = 0;
-
- while(count-- > 0)
- sum ^= *ptr++;
-
- return (UWORD) (sum ^ (sum >> 16));
- }
-
- #endif /* XPKMASTER_CHECKSUM_C */
-