Fix compilation warnings related to checksum shifting
This commit is contained in:
parent
bfb67f0c79
commit
c4bbb3a7a7
1 changed files with 2 additions and 2 deletions
|
|
@ -130,7 +130,7 @@ void eeprom_put_char( unsigned int addr, unsigned char new_value )
|
||||||
void memcpy_to_eeprom_with_checksum(unsigned int destination, char *source, unsigned int size) {
|
void memcpy_to_eeprom_with_checksum(unsigned int destination, char *source, unsigned int size) {
|
||||||
unsigned char checksum = 0;
|
unsigned char checksum = 0;
|
||||||
for(; size > 0; size--) {
|
for(; size > 0; size--) {
|
||||||
checksum = (checksum << 1) || (checksum >> 7);
|
checksum = ((checksum << 1) != 0) || (checksum >> 7);
|
||||||
checksum += *source;
|
checksum += *source;
|
||||||
eeprom_put_char(destination++, *(source++));
|
eeprom_put_char(destination++, *(source++));
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +141,7 @@ int memcpy_from_eeprom_with_checksum(char *destination, unsigned int source, uns
|
||||||
unsigned char data, checksum = 0;
|
unsigned char data, checksum = 0;
|
||||||
for(; size > 0; size--) {
|
for(; size > 0; size--) {
|
||||||
data = eeprom_get_char(source++);
|
data = eeprom_get_char(source++);
|
||||||
checksum = (checksum << 1) || (checksum >> 7);
|
checksum = ((checksum << 1) != 0) || (checksum >> 7);
|
||||||
checksum += data;
|
checksum += data;
|
||||||
*(destination++) = data;
|
*(destination++) = data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue