Use unsigned int for crc calculation

This commit is contained in:
Allen Ibara
2010-09-15 04:59:38 +00:00
parent 8a43cb0467
commit 89167c15bd
+1 -1
View File
@@ -76,7 +76,7 @@ int spi_link_send(void *buf_out, size_t count, void *buf_in, uint8_t* crc_valid)
#define TOPBIT (1 << (WIDTH - 1))
uint8_t crc_calc_block_crc8(const uint8_t buf[], uint32_t len) {
uint8_t _remainder = 0;
for (int byte = 0; byte < len; ++byte) {
for (uint32_t byte = 0; byte < len; ++byte) {
_remainder ^= (buf[byte] << (WIDTH - 8));
for (uint8_t bit = 8; bit > 0; --bit) {
if (_remainder & TOPBIT)