Package: avr-libc
Version: 1:1.4.3-1
Severity: wishlist
/usr/avr/include/util/crc16.h has four CRC functions; only one,
_crc16_update, lacks a C equivalent. Patch attached.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.5
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
-- no debconf information
--- /usr/avr/include/util/crc16.h 2006-02-05 07:19:18.000000000 -0500
+++ crc16.h 2006-04-03 22:41:44.912308637 -0400
@@ -82,7 +82,29 @@
Polynomial: x^16 + x^15 + x^2 + 1 (0xa001)<br>
Initial value: 0xffff
- This CRC is normally used in disk-drive controllers. */
+ This CRC is normally used in disk-drive controllers.
+
+ The following is the equivalent functionality written in C.
+
+ \code
+ uint16_t
+ crc16_update( uint16_t crc, uint8_t a )
+ {
+ int i;
+
+ crc ^= a;
+ for( i = 0; i < 8; ++i )
+ {
+ if( crc & 1 )
+ crc = (crc>>1) ^ 0xA001;
+ else
+ crc = (crc>>1);
+ }
+
+ return crc;
+ }
+
+ \endcode */
static __inline__ uint16_t
_crc16_update(uint16_t __crc, uint8_t __data)