PreviousNext
CC5X Compiler
Help > Appendix > One’s Complement Fletcher-16 Checksum Calculation > CC5X Compiler

// Initialize One’s Complement Fletcher Checksum

uns16 checksum = “initial value”;

 

...

 

// Loop through all data bytes, each stored at oneByte

 

// Update lower checksum byte

checksum.low8 += oneByte;

checksum.low8 += Carry;

// Update higher checksum byte

checksum.high8 += checksum.low8;

checksum.high8 += Carry