+1 if there is backwards compatibility and proper documentation On Tue, 8 Apr 2025, 04:00 chao an, <magicd...@gmail.com> wrote:
> Hi, Greg, > > Glad to hear your voice. > > In the current crc16 implementation, we have provided 3 variants. The > default crc16 semantics is CRC-16/XMODEM: > > CRC-16/XMODEM: > crc16 > crc16part > https://github.com/apache/nuttx/blob/master/libs/libc/misc/lib_crc16.c > > CRC-16/CCITT-TRUE: > crc16ccitt > crc16ccittpart > > https://github.com/apache/nuttx/blob/master/libs/libc/misc/lib_crc16ccitt.c > > CRC-16/IBM: > crc16ibm > crc16ibmpart > > https://github.com/apache/nuttx/blob/master/libs/libc/misc/lib_crc16ibm.c > > > In PR16147, I mapped the default crc16 implementation to CRC-16/IBM. NuttX > did not abandon other variants, but provided more specific interface > implementations: > https://github.com/apache/nuttx/pull/16147 > > CRC-16/XMODEM: > crc16xmodem > crc16xmodempart > > CRC-16/CCITT-TRUE: > crc16ccitt > crc16ccittpart > > CRC-16/IBM: > crc16ibm > crc16ibmpart > > New crc16 implement, just mapping these APIs to CRC-16/IBM, developers are > free to choose which variant to use > > uint16_t crc16part(FAR const uint8_t *src, size_t len, uint16_t crc16val) > { > return crc16ibmpart(src, len, crc16val); > } > > uint16_t crc16(FAR const uint8_t *src, size_t len) > { > return crc16ibmpart(src, len, 0); > } > > BRs, > > Gregory Nutt <spudan...@gmail.com> 于2025年4月8日周二 09:43写道: > > > > What if you need both versions at the same time? Rather than an option > > to use one or the the other, options to enable one or both would be more > > flexible. > > >