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;

if ( Carry )

  checksum.low8++;

 

// Update higher checksum byte

checksum.high8 += checksum.low8;

if ( Carry )

  checksum.high8++;