H08325 s 00049/00000/00000 d D 1.1 02/03/13 22:41:30 patch 2 1 cC cF1 cK43814 cO-rw-rw-r-- e s 00000/00000/00000 d D 1.0 02/03/13 22:41:30 patch 1 0 c BitKeeper file /home/marcelo/bk/linux-2.4/include/linux/crc32.h cBtorvalds@athlon.transmeta.com|ChangeSet|20020205173056|16047|c1d11a41ed024864 cHplucky.distro.conectiva cK41082 cPinclude/linux/crc32.h cR8086b6308dd798b4 cV4 cX0x821 cZ-03:00 e u U f e 0 f x 0x821 t T I 2 /* * crc32.h for early Linux 2.4.19pre kernel inclusion * This defines ether_crc_le() and ether_crc() as inline functions * This is slated to change to using the library crc32 functions * as kernel 2.5.2 included at some future date. */ #ifndef _LINUX_CRC32_H #define _LINUX_CRC32_H #include /* The little-endian AUTODIN II ethernet CRC calculation. N.B. Do not use for bulk data, use a table-based routine instead. This is common code and should be moved to net/core/crc.c */ static unsigned const ethernet_polynomial_le = 0xedb88320U; static inline unsigned ether_crc_le(int length, unsigned char *data) { unsigned int crc = 0xffffffff; /* Initial value. */ while(--length >= 0) { unsigned char current_octet = *data++; int bit; for (bit = 8; --bit >= 0; current_octet >>= 1) { if ((crc ^ current_octet) & 1) { crc >>= 1; crc ^= ethernet_polynomial_le; } else crc >>= 1; } } return crc; } static unsigned const ethernet_polynomial = 0x04c11db7U; static inline u32 ether_crc(int length, unsigned char *data) { int crc = -1; while (--length >= 0) { unsigned char current_octet = *data++; int bit; for (bit = 0; bit < 8; bit++, current_octet >>= 1) { crc = (crc << 1) ^ ((crc < 0) ^ (current_octet & 1) ? ethernet_polynomial : 0); } } return crc; } #endif /* _LINUX_CRC32_H */ E 2 I 1 E 1