diff options
Diffstat (limited to 'linux-2.4.x/include/linux/crc32.h')
-rw-r--r-- | linux-2.4.x/include/linux/crc32.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/linux-2.4.x/include/linux/crc32.h b/linux-2.4.x/include/linux/crc32.h index 0149736..9dd38cb 100644 --- a/linux-2.4.x/include/linux/crc32.h +++ b/linux-2.4.x/include/linux/crc32.h @@ -46,4 +46,25 @@ static inline u32 ether_crc(int length, unsigned char *data) return crc; } -#endif /* _LINUX_CRC32_H */ +#ifndef CRC32_H +#define CRC32_H + +/* $Id: crc32.h,v 1.5 2005/11/07 11:14:38 gleixner Exp $ */ + +#include <linux/types.h> + +extern const uint32_t crc32_table[256]; + +/* Return a 32-bit CRC of the contents of the buffer. */ + +static inline uint32_t +crc32(uint32_t 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 +#endif |