mirror of
https://github.com/peter-tanner/peter-tanner.github.io.git
synced 2024-11-30 12:00:18 +08:00
9 lines
250 B
C
9 lines
250 B
C
|
|
unsigned char get_checksum(unsigned char array[], unsigned char array_size)
|
|
{
|
|
unsigned char checksum = 0;
|
|
for (unsigned char i = 1; i < array_size - 2; i++)
|
|
checksum += array[i];
|
|
checksum = (~checksum) + 1;
|
|
return checksum;
|
|
} |