Goodday, I need to port the following C code in Python, but I can't find a good way to do the unsigned char arithmetic that ignores the overflow bits in python, ie. 255+1=0; 255+2=1 etc. The code below is used in a checksum calculation for a protocol that is implemented in C on the Arduino that I need to interface with.
unsigned char b[length];
unsigned char c1=0,c2=0,c3=0,c4=0;
for (i=0; i<length;i++)
{
c1+=b[i];
c2+=c1;
c3+=c2;
c4+=c3;
}