Remake of Fletcher checksum from 32bit to 8
问题 Is this conversion right from the original? uint8_t fletcher8( uint8_t *data, uint8_t len ) { uint8_t sum1 = 0xff, sum2 = 0xff; while (len) { unsigned tlen = len > 360 ? 360 : len; len -= tlen; do { sum1 += *data++; sum2 += sum1; tlen -= sizeof( uint8_t ); } while (tlen); sum1 = (sum1 & 0xff) + (sum1 >> 4); sum2 = (sum2 & 0xff) + (sum2 >> 4); } /* Second reduction step to reduce sums to 4 bits */ sum1 = (sum1 & 0xff) + (sum1 >> 4); sum2 = (sum2 & 0xff) + (sum2 >> 4); return sum2 << 4 | sum1;