firmware-utils/mktplinkfw: add support for the TL-MR3220 v1
[openwrt.git] / package / mtd / src / crc32.h
1 #ifndef CRC32_H
2 #define CRC32_H
3
4 #include <stdint.h>
5
6 extern const uint32_t crc32_table[256];
7
8 /* Return a 32-bit CRC of the contents of the buffer. */
9
10 static inline uint32_t
11 crc32(uint32_t val, const void *ss, int len)
12 {
13 const unsigned char *s = ss;
14 while (--len >= 0)
15 val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
16 return val;
17 }
18
19 static inline unsigned int crc32buf(char *buf, size_t len)
20 {
21 return crc32(0xFFFFFFFF, buf, len);
22 }
23
24
25
26 #endif
This page took 0.050672 seconds and 5 git commands to generate.