Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef __CHECKSUM_H
00007 #define __CHECKSUM_H
00008
00009 #include "RakMemoryOverride.h"
00010
00012 class CheckSum
00013 {
00014
00015 public:
00016
00018
00019 CheckSum()
00020 {
00021 Clear();
00022 }
00023
00024 void Clear()
00025 {
00026 sum = 0;
00027 r = 55665;
00028 c1 = 52845;
00029 c2 = 22719;
00030 }
00031
00032 void Add ( unsigned int w );
00033
00034
00035 void Add ( unsigned short w );
00036
00037 void Add ( unsigned char* b, unsigned int length );
00038
00039 void Add ( unsigned char b );
00040
00041 unsigned int Get ()
00042 {
00043 return sum;
00044 }
00045
00046 protected:
00047 unsigned short r;
00048 unsigned short c1;
00049 unsigned short c2;
00050 unsigned int sum;
00051 };
00052
00053 #endif