cleanup mtd, implement jffs2write - one step closer to config preserving system upgrades
[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 #endif