File: crc32.h

package info (click to toggle)
libmspack 0.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,876 kB
  • sloc: ansic: 8,128; sh: 4,660; perl: 320; makefile: 100
file content (17 lines) | stat: -rw-r--r-- 377 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef CRC32_H
#define CRC32_H

extern const unsigned int crc32_table[256];

/* Return a 32-bit CRC of the contents of the buffer. */

static inline unsigned int
crc32(unsigned int val, const void *ss, int len)
{
        const unsigned char *s = ss;
        while (--len >= 0)
                val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
        return val;
}

#endif