Zero length init value reversal for reflect in&out
I actually did not find if there is a "correct behaviour" for this...
I wanted to match an old legacy code that I found, which actually mostly matches
crc_utils::crc<uint8_t, 0x31, 0xbf, true, true, 0x00>
however, for zero length inputs it returns 0xfd (which is the reverse of 0xbf)
while your implentation returns 0xbf
Do you know if there is a common understanding on how to handle the initial value in case of zero length inputs with in&out reversal?
And if there is no clear decision, would it make sense to have an option/parameter that allows to disable the crc = reverse(crc); (ref)
Regards
This sent me down a bit of a rabbit hole trying to find out if there was a "correct" behavior. And while I wasn't able to find a definitive answer, all the checksum calculators I was able to try that supported a "no data" option did apply a reverse to the initial value when output reflections were enabled. So, it seems that it's a fairly standard thing to do that I clearly missed. Great catch, and thank you for pointing that out to me!
I've updated the code with the fix, and added extra test cases for the 0 data length cases (Including one for your use-case) here: https://github.com/DarrenLevine/cppcrc/blob/main/test/test_cppcrc.cpp#L71-L119