00001 #ifndef CRC32_H 00002 #define CRC32_H 00003 00004 /* $Id: crc-32.h 114 2004-08-20 13:14:08Z poggij $ */ 00005 /* Code stealth from jffs2 source */ 00006 00007 //#include <include.h> 00008 #define UINT32 unsigned long 00009 00010 extern const UINT32 crc32_table[256]; 00011 00012 /* Return a 32-bit CRC of the contents of the buffer. */ 00013 00014 static inline UINT32 doFCS(const void *ss, int len) 00015 { 00016 const unsigned char *s = ss; 00017 UINT32 val = 0xffffffff; 00018 00019 while (--len >= 0) 00020 val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8); 00021 return val; 00022 } 00023 00024 #endif