> -----Original Message----- > From: avr-libc-dev-bounces+eric.weddington=atmel....@nongnu.org > [mailto:avr-libc-dev-bounces+eric.weddington=atmel....@nongnu.org] On > Behalf Of Joerg Wunsch > Sent: Tuesday, December 11, 2012 8:39 AM > To: avr-libc-dev@nongnu.org > Cc: mojo > Subject: Re: [avr-libc-dev] [bug #37901] CRC-CCITT calculation incorrect > > All the functions of this header file (_crc16_update which once > started the file but uses the "IBM-CRC-16" polynomial, > _crc_xmodem_update, _crc_ccitt_update, and finally > _crc_ibutton_update) have been deliberately chosen to lie in the > implementation namespace so they don't collide with the application > namespace. > > Thus, an application could do something like this: > > #if defined(__AVR__) && defined(__GNUC__) > # define crc_ccitt_update(c, v) _crc_ccitt_update(c, v) > #else > inline uint16_t crc_ccitt_update(uint16_t crc, uint8_t data) > { > data ^= crc & 0xff; > data ^= data << 4; > > return ((((uint16_t)data << 8) | ((crc & 0xff00) >> 8)) > ^ (uint8_t)(data >> 4) > ^ ((uint16_t)data << 3)); > } > #endif
Then how about a name that is more meaningful & intuitive? >From experience, you can tell users all day long in the documentation, and in >the FAQ, to use _crc_xmodem_update() and they still won't get it. Can we create an alias macro? _crc_xmega_ccitt_update()? Then put the explanation in the docs. We need to support the xmega users better. If they're getting easily confused, then we need to help. Eric _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev