-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lookup table based crc-8 implementation #492
Conversation
* @return crc - Computed CRC-8 value. | ||
*******************************************************************************/ | ||
uint8_t crc8(const uint8_t * table, const uint8_t *pdata, size_t nbytes, | ||
uint8_t crc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the description says the last parameter (crc) represents the initial value, wouldn't it be more clear to rename it this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added more explanation to the function documentation. basically, the value you put there is typically a crc so i think it makes sense the stay that way
util/crc8.c
Outdated
* @brief Source file of CRC-8 computation. | ||
* @author Darius Berghe ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2012(c) Analog Devices, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2012 -> 2020.
util/crc8.c
Outdated
|
||
return crc; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: extra line :D
This is code compatible with linux crc8.h although the implementation is somewhat different. This implementation is supposed to replace all crc-8 implementations in no-OS drivers which are all duplicates of each other. By comparing the performance of this new implementation with the old one on an x86 machine and on large sample sizes, it seems the new implementation is faster by a factor of 13. Signed-off-by: Darius Berghe <[email protected]>
Following previous comments I:
|
This is code compatible with linux crc8.h although the implementation is
somewhat different.
This implementation is supposed to replace all crc-8 implementations in no-OS
drivers which are all duplicates of each other.
By comparing the performance of this new implementation with the old one on
an x86 machine and on large sample sizes, it seems the new implementation is
faster by a factor of 13.
I suggest to review but not merge this until we have a working projects/ad7768-1 to test it on. I did test it on x86 and gives the same result as our existing algorithm.