Subversion Repositories SvarDOS

Rev

Rev 614 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 614 Rev 1959
Line 113... Line 113...
113
 
113
 
114
/* Return a 32-bit CRC of the contents of the buffer. */
114
/* Return a 32-bit CRC of the contents of the buffer. */
115
 
115
 
116
 
116
 
117
unsigned long crc32_init(void) {
117
unsigned long crc32_init(void) {
118
  return(0xFFFFFFFFlu);
118
  return(CRC32_INITVAL);
119
}
119
}
120
 
120
 
121
void crc32_feed(unsigned long *crc32val, const unsigned char *s, unsigned int len) {
121
void crc32_feed(unsigned long *crc32val, const unsigned char *s, unsigned int len) {
122
  unsigned long i;
122
  unsigned int i;
123
  for (i = 0; i < len; i++) *crc32val = crc32_tab[(*crc32val ^ s[i]) & 0xff] ^ (*crc32val >> 8);
123
  for (i = 0; i < len; i++) *crc32val = crc32_tab[(*crc32val ^ s[i]) & 0xff] ^ (*crc32val >> 8);
124
}
124
}
125
 
125
 
126
void crc32_finish(unsigned long *crc32val) {
126
void crc32_finish(unsigned long *crc32val) {
127
  *crc32val ^= 0xFFFFFFFFlu;
127
  *crc32val ^= 0xFFFFFFFFlu;