I couldn't find this when I went looking for it. So I modified the example in the crc_xmodem_update function, to come up with the following code. This saved me 252 bytes vs. a lookup table. I don't know if this CRC is too specific to this application to be included in this project or not, but here it is anyways. Maybe it will help someone.
Wed 20 Apr 2005 11:32:23 PM CEST
I couldn't find this when I went looking for it. So I modified the example in the crc_xmodem_update function, to come up with the following code. This saved me 252 bytes vs. a lookup table. I don't know if this CRC is too specific to this application to be included in this project or not, but here it is anyways. Maybe it will help someone.
uint8_t crc_ibutton_update (uint8_t crc, uint8_t data) { char i;
crc = crc ^ data; for (i=0; i<8; i++) { if (crc & 0x01) crc = (crc >> 1) ^ 0x8C; else crc >>= 1; }
return crc; }
This issue was migrated from https://savannah.nongnu.org/patch/?3925