Closed ModischFabrications closed 2 years ago
Thanks for pointing out, I did not test that yet. Did you ran a test to see the gain? even a few micros will add up!
Haven't benchmarked it yet, but even the convenience and safety of passing const is worth it in my opinion.
Quick test on AVR with the performance sketch shows no difference. Compiler seems smart enough.
But I noticed that the length parameter was not implemented consequently uint8_t vs uint32_t. So that will all be updated to uint8_t as that should be large enough for most (Arduino) applications.
Created branch - https://github.com/RobTillaart/CRC/tree/Fix11
prepared as a new version 0.1.5
PR created - https://github.com/RobTillaart/CRC/pull/12
can you verify that Fix11 branch works for you? if so I will merge it into master branch.
Added comments to the PR, i think const for value-types are not needed though. Looks good nonetheless, feel free to close this issue.
crc* functions don't modify the array passed, shouldn't they be marked as
const
? This would allow these function to handle string-type input a lot better.uint16_t crc16(const uint8_t* array, ....
Test:
crc16("Test123", 16);