Closed daniel-mohr closed 2 years ago
Sorry, this PR is based on #6. I hope #6 is OK and therefore also this dependency here.
As it is rather late I will dive into the proposed code tomorrow. The numbers are not always an improvement, so it might need conditional code to select fastest method per platform. If AVR ..erc
Looks good, merging this makes PR #6 obsolete.
Since #6 gives a test of all Fletcher implementations here, I also investigated quickly the ideas written on wikipedia:Fletcher's checksum.
Using bit shifts instead of the if statement could speed up the things:
I believe that for 8 Bit (Fletcher16) it's always the same. Therefore I adapted your code here.
For more than 8 Bit (Fletcher32 or Fletcher64) I believe it depends on the platform. Therefore I adapted your code only for SAMD21, which I could test. This could be enhanced for all 16 Bit or 32 Bit systems.
I hope this PR is OK?