ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/crc.h
Revision: 1.1
Committed: Thu Feb 15 18:09:34 2007 UTC (17 years, 4 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_0, rel-2_1
Log Message:
- the damn rotate shift checksum just failed on me
- add crc32 and use it for bmaps_checksum (probably also for images).

File Contents

# User Rev Content
1 root 1.1 #ifndef CRC_H__
2     #define CRC_H__
3    
4     #include "traits.h"
5    
6     struct crc32
7     {
8     uint32_t crc;
9    
10     crc32 ()
11     {
12     crc = ~uint32_t (0);
13     }
14    
15     void
16     operator ()(const uint8_t byte)
17     {
18     extern const uint32_t crc_32_tab[256];
19     crc = crc_32_tab[uint8_t (crc) ^ byte] ^ (crc >> 8);
20     }
21    
22     operator uint32_t () { return crc; }
23     };
24    
25     #endif